From 376a0efd0e4476dc9d7aa7b9e85f3227f72143a1 Mon Sep 17 00:00:00 2001 From: Felix Abecassis Date: Tue, 5 Sep 2017 19:16:49 -0700 Subject: [PATCH 01/11] Initial commit for branch 2.0 --- Dockerfile.centos7 | 36 ++++++++++++++ Dockerfile.xenial | 38 ++++++++++++++ Makefile | 66 +++++++++++++++++++++++++ README.md | 3 ++ daemon.json | 8 +++ debian/compat | 1 + debian/control | 18 +++++++ debian/copyright | 35 +++++++++++++ debian/nvidia-docker2.install | 2 + debian/nvidia-docker2.lintian-overrides | 2 + debian/prepare | 6 +++ debian/rules | 7 +++ nvidia-docker | 31 ++++++++++++ rpm/SOURCES/LICENSE | 25 ++++++++++ rpm/SPECS/nvidia-docker2.spec | 39 +++++++++++++++ 15 files changed, 317 insertions(+) create mode 100644 Dockerfile.centos7 create mode 100644 Dockerfile.xenial create mode 100644 Makefile create mode 100644 README.md create mode 100644 daemon.json create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/nvidia-docker2.install create mode 100644 debian/nvidia-docker2.lintian-overrides create mode 100755 debian/prepare create mode 100755 debian/rules create mode 100755 nvidia-docker create mode 100644 rpm/SOURCES/LICENSE create mode 100644 rpm/SPECS/nvidia-docker2.spec diff --git a/Dockerfile.centos7 b/Dockerfile.centos7 new file mode 100644 index 0000000..147f17c --- /dev/null +++ b/Dockerfile.centos7 @@ -0,0 +1,36 @@ +FROM centos:7 + +# packaging dependencies +RUN yum install -y \ + rpm-build && \ + rm -rf /var/cache/yum/* + +# packaging +ARG PKG_VERS +ARG PKG_REV +ARG RUNTIME_VERSION +ARG DOCKER_VERSION + +ENV VERSION $PKG_VERS +ENV RELEASE $PKG_REV +ENV RUNTIME_VERSION $RUNTIME_VERSION +ENV DOCKER_VERSION $DOCKER_VERSION + +# output directory +ENV DIST_DIR=/tmp/nvidia-container-runtime-$PKG_VERS/SOURCES +RUN mkdir -p $DIST_DIR + +COPY nvidia-docker $DIST_DIR +COPY daemon.json $DIST_DIR + +WORKDIR $DIST_DIR/.. +COPY rpm . + +CMD rpmbuild --clean -bb \ + -D "_topdir $PWD" \ + -D "version $VERSION" \ + -D "release $RELEASE" \ + -D "runtime_version $RUNTIME_VERSION" \ + -D "docker_version $DOCKER_VERSION" \ + SPECS/nvidia-docker2.spec && \ + mv RPMS/noarch/*.rpm /dist diff --git a/Dockerfile.xenial b/Dockerfile.xenial new file mode 100644 index 0000000..30421bd --- /dev/null +++ b/Dockerfile.xenial @@ -0,0 +1,38 @@ +FROM ubuntu:xenial + +# packaging dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + dh-make \ + fakeroot \ + build-essential \ + devscripts && \ + rm -rf /var/lib/apt/lists/* + +# packaging +ARG PKG_VERS +ARG PKG_REV +ARG RUNTIME_VERSION +ARG DOCKER_VERSION + +ENV DEBFULLNAME "NVIDIA CORPORATION" +ENV DEBEMAIL "cudatools@nvidia.com" +ENV REVISION "$PKG_VERS-$PKG_REV" +ENV RUNTIME_VERSION $RUNTIME_VERSION +ENV DOCKER_VERSION $DOCKER_VERSION + +# output directory +ENV DIST_DIR=/tmp/nvidia-docker2-$PKG_VERS +RUN mkdir -p $DIST_DIR + +# nvidia-docker 2.0 +COPY nvidia-docker $DIST_DIR/nvidia-docker +COPY daemon.json $DIST_DIR/daemon.json + +WORKDIR $DIST_DIR +COPY debian ./debian + +RUN dch --create --package nvidia-docker2 -v "$REVISION" "v$REVISION" && \ + dch -r "" + +CMD debuild --preserve-env --dpkg-buildpackage-hook='sh debian/prepare' -i -us -uc -b && \ + mv /tmp/*.deb /dist diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0acd67e --- /dev/null +++ b/Makefile @@ -0,0 +1,66 @@ +# Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. + +DOCKER ?= docker + +VERSION := 2.0.0 +PKG_REV := 1 +RUNTIME_VERSION := 1.0.0 + +DIST_DIR := $(CURDIR)/dist + +.NOTPARALLEL: +.PHONY: all + +all: xenial centos7 + +xenial: 17.06.1-xenial 17.03.2-xenial 1.13.1-xenial 1.12.6-xenial + +centos7: 17.06.1.ce-centos7 17.03.2.ce-centos7 + +17.06.1-xenial: + $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)+docker17.06.1-1" \ + --build-arg DOCKER_VERSION="17.06.1~ce-0~ubuntu" \ + --build-arg PKG_VERS="$(VERSION)+docker17.06.1" \ + --build-arg PKG_REV="$(PKG_REV)" \ + -t nvidia-docker2:$@ -f Dockerfile.xenial . + $(DOCKER) run --rm -v $(DIST_DIR)/xenial:/dist:Z nvidia-docker2:$@ + +17.03.2-xenial: + $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)+docker17.03.2-1" \ + --build-arg DOCKER_VERSION="17.03.2~ce-0~ubuntu-xenial" \ + --build-arg PKG_VERS="$(VERSION)+docker17.03.2" \ + --build-arg PKG_REV="$(PKG_REV)" \ + -t nvidia-docker2:$@ -f Dockerfile.xenial . + $(DOCKER) run --rm -v $(DIST_DIR)/xenial:/dist:Z nvidia-docker2:$@ + +1.13.1-xenial: + $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)+docker1.13.1-1" \ + --build-arg DOCKER_VERSION="1.13.1-0~ubuntu-xenial" \ + --build-arg PKG_VERS="$(VERSION)+docker1.13.1" \ + --build-arg PKG_REV="$(PKG_REV)" \ + -t nvidia-docker2:$@ -f Dockerfile.xenial . + $(DOCKER) run --rm -v $(DIST_DIR)/xenial:/dist:Z nvidia-docker2:$@ + +1.12.6-xenial: + $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)+docker1.12.6-1" \ + --build-arg DOCKER_VERSION="1.12.6-0~ubuntu-xenial" \ + --build-arg PKG_VERS="$(VERSION)+docker1.12.6" \ + --build-arg PKG_REV="$(PKG_REV)" \ + -t nvidia-docker2:$@ -f Dockerfile.xenial . + $(DOCKER) run --rm -v $(DIST_DIR)/xenial:/dist:Z nvidia-docker2:$@ + +17.06.1.ce-centos7: + $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-17.06.1.1" \ + --build-arg DOCKER_VERSION="17.06.1.ce" \ + --build-arg PKG_VERS="$(VERSION)" \ + --build-arg PKG_REV="17.06.1.ce.$(PKG_REV)" \ + -t nvidia-docker2:$@ -f Dockerfile.centos7 . + $(DOCKER) run --rm -v $(DIST_DIR)/centos7:/dist:Z nvidia-docker2:$@ + +17.03.2.ce-centos7: + $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-17.03.2.1" \ + --build-arg DOCKER_VERSION="17.03.2.ce" \ + --build-arg PKG_VERS="$(VERSION)" \ + --build-arg PKG_REV="17.03.2.ce.$(PKG_REV)" \ + -t nvidia-docker2:$@ -f Dockerfile.centos7 . + $(DOCKER) run --rm -v $(DIST_DIR)/centos7:/dist:Z nvidia-docker2:$@ diff --git a/README.md b/README.md new file mode 100644 index 0000000..bb2a664 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Docker Engine Utility for NVIDIA GPUs + +## Transition to version 2.0 diff --git a/daemon.json b/daemon.json new file mode 100644 index 0000000..83f574d --- /dev/null +++ b/daemon.json @@ -0,0 +1,8 @@ +{ + "runtimes": { + "nvidia": { + "path": "/usr/bin/nvidia-container-runtime", + "runtimeArgs": [] + } + } +} diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..59d792c --- /dev/null +++ b/debian/control @@ -0,0 +1,18 @@ +Source: nvidia-docker2 +Section: devel +Priority: optional +Maintainer: NVIDIA CORPORATION +Standards-Version: 3.9.8 +Homepage: https://github.com/NVIDIA/nvidia-docker/wiki +Vcs-Git: https://github.com/NVIDIA/nvidia-docker +Vcs-Browser: https://github.com/NVIDIA/nvidia-docker +Build-Depends: debhelper (>= 9) + +Package: nvidia-docker2 +Architecture: all +Breaks: nvidia-docker +Replaces: nvidia-docker +Depends: ${misc:Depends}, nvidia-container-runtime (= #RUNTIME_VERSION#), docker-ce (= #DOCKER_VERSION#) | docker-ee (= #DOCKER_VERSION#) | docker-engine (= #DOCKER_VERSION#) +Description: nvidia-docker CLI wrapper + Replaces nvidia-docker with a new implementation based on + nvidia-container-runtime diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..e7d1871 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,35 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: nvidia-docker2 +Source: https://github.com/NVIDIA/nvidia-docker + +Files: * +Copyright: 2017 NVIDIA CORPORATION +License: BSD-3-Clause + +License: BSD-3-clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + . + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/debian/nvidia-docker2.install b/debian/nvidia-docker2.install new file mode 100644 index 0000000..80ceb40 --- /dev/null +++ b/debian/nvidia-docker2.install @@ -0,0 +1,2 @@ +daemon.json /etc/docker +nvidia-* /usr/bin \ No newline at end of file diff --git a/debian/nvidia-docker2.lintian-overrides b/debian/nvidia-docker2.lintian-overrides new file mode 100644 index 0000000..52373fb --- /dev/null +++ b/debian/nvidia-docker2.lintian-overrides @@ -0,0 +1,2 @@ +new-package-should-close-itp-bug +binary-without-manpage diff --git a/debian/prepare b/debian/prepare new file mode 100755 index 0000000..772c42b --- /dev/null +++ b/debian/prepare @@ -0,0 +1,6 @@ +#! /bin/sh + +set -e + +sed -i "s/#RUNTIME_VERSION#/${RUNTIME_VERSION}/g" debian/control +sed -i "s/#DOCKER_VERSION#/${DOCKER_VERSION}/g" debian/control diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..f3908b2 --- /dev/null +++ b/debian/rules @@ -0,0 +1,7 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +#export DH_VERBOSE=1 + +%: + dh $@ diff --git a/nvidia-docker b/nvidia-docker new file mode 100755 index 0000000..53864c5 --- /dev/null +++ b/nvidia-docker @@ -0,0 +1,31 @@ +#! /bin/bash +# Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. + +NV_DOCKER=${NV_DOCKER:-"docker"} + +DOCKER_ARGS="" +NV_DOCKER_ARGS="" +while [ $# -gt 0 ]; do + arg=$1 + shift + DOCKER_ARGS="$DOCKER_ARGS $arg" + case $arg in + run|create) + NV_DOCKER_ARGS="--runtime=nvidia" + if [ ! -z $NV_GPU ]; then + NV_DOCKER_ARGS="$NV_DOCKER_ARGS -e NVIDIA_VISIBLE_DEVICES=${NV_GPU// /,}" + fi + break + ;; + version) + printf "NVIDIA Docker: 2.0.0\n" + break + ;; + esac +done + +if [ ! -z $NV_DEBUG ]; then + set -x +fi + +$NV_DOCKER $DOCKER_ARGS $NV_DOCKER_ARGS "$@" diff --git a/rpm/SOURCES/LICENSE b/rpm/SOURCES/LICENSE new file mode 100644 index 0000000..43ba609 --- /dev/null +++ b/rpm/SOURCES/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of NVIDIA CORPORATION nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/rpm/SPECS/nvidia-docker2.spec b/rpm/SPECS/nvidia-docker2.spec new file mode 100644 index 0000000..5e485a2 --- /dev/null +++ b/rpm/SPECS/nvidia-docker2.spec @@ -0,0 +1,39 @@ +Name: nvidia-docker2 +Version: %{version} +Release: %{release} +BuildArch: noarch +Group: Development Tools + +Vendor: NVIDIA CORPORATION +Packager: NVIDIA CORPORATION + +Summary: nvidia-docker CLI wrapper +URL: https://github.com/NVIDIA/nvidia-docker +License: BSD + +Source0: nvidia-docker +Source1: daemon.json +Source2: LICENSE + +Conflicts: nvidia-docker +Requires: nvidia-container-runtime = %{runtime_version} +Requires: docker-ce = %{docker_version} + +%description +Replaces nvidia-docker with a new implementation based on nvidia-container-runtime + +%prep +cp %{SOURCE0} %{SOURCE1} %{SOURCE2} . + +%install +mkdir -p %{buildroot}%{_bindir} +install -m 755 -t %{buildroot}%{_bindir} nvidia-docker +mkdir -p %{buildroot}/etc/docker +install -m 644 -t %{buildroot}/etc/docker daemon.json + +%files +%license LICENSE +%{_bindir}/nvidia-docker +/etc/docker/daemon.json + +%changelog From bbdc9dc3422ccc6dacb62866462a05164337376e Mon Sep 17 00:00:00 2001 From: Felix Abecassis Date: Wed, 6 Sep 2017 15:03:54 -0700 Subject: [PATCH 02/11] Add support for 17.06.2 --- Makefile | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0acd67e..3712b3c 100644 --- a/Makefile +++ b/Makefile @@ -13,9 +13,17 @@ DIST_DIR := $(CURDIR)/dist all: xenial centos7 -xenial: 17.06.1-xenial 17.03.2-xenial 1.13.1-xenial 1.12.6-xenial +xenial: 17.06.2-xenial 17.06.1-xenial 17.03.2-xenial 1.13.1-xenial 1.12.6-xenial -centos7: 17.06.1.ce-centos7 17.03.2.ce-centos7 +centos7: 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-centos7 + +17.06.2-xenial: + $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)+docker17.06.2-1" \ + --build-arg DOCKER_VERSION="17.06.2~ce-0~ubuntu" \ + --build-arg PKG_VERS="$(VERSION)+docker17.06.2" \ + --build-arg PKG_REV="$(PKG_REV)" \ + -t nvidia-docker2:$@ -f Dockerfile.xenial . + $(DOCKER) run --rm -v $(DIST_DIR)/xenial:/dist:Z nvidia-docker2:$@ 17.06.1-xenial: $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)+docker17.06.1-1" \ @@ -49,6 +57,14 @@ centos7: 17.06.1.ce-centos7 17.03.2.ce-centos7 -t nvidia-docker2:$@ -f Dockerfile.xenial . $(DOCKER) run --rm -v $(DIST_DIR)/xenial:/dist:Z nvidia-docker2:$@ +17.06.2.ce-centos7: + $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-17.06.2.1" \ + --build-arg DOCKER_VERSION="17.06.2.ce" \ + --build-arg PKG_VERS="$(VERSION)" \ + --build-arg PKG_REV="17.06.2.ce.$(PKG_REV)" \ + -t nvidia-docker2:$@ -f Dockerfile.centos7 . + $(DOCKER) run --rm -v $(DIST_DIR)/centos7:/dist:Z nvidia-docker2:$@ + 17.06.1.ce-centos7: $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-17.06.1.1" \ --build-arg DOCKER_VERSION="17.06.1.ce" \ From 9deb68f70722cec7fa5b0a587de3e75bade4984e Mon Sep 17 00:00:00 2001 From: Felix Abecassis Date: Wed, 6 Sep 2017 15:55:05 -0700 Subject: [PATCH 03/11] Improve the portability of the debian/control file --- Dockerfile.xenial | 4 +++- debian/control | 4 ++-- debian/prepare | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Dockerfile.xenial b/Dockerfile.xenial index 30421bd..d8dbc6d 100644 --- a/Dockerfile.xenial +++ b/Dockerfile.xenial @@ -19,6 +19,8 @@ ENV DEBEMAIL "cudatools@nvidia.com" ENV REVISION "$PKG_VERS-$PKG_REV" ENV RUNTIME_VERSION $RUNTIME_VERSION ENV DOCKER_VERSION $DOCKER_VERSION +ENV DISTRIB "UNRELEASED" +ENV SECTION "" # output directory ENV DIST_DIR=/tmp/nvidia-docker2-$PKG_VERS @@ -31,7 +33,7 @@ COPY daemon.json $DIST_DIR/daemon.json WORKDIR $DIST_DIR COPY debian ./debian -RUN dch --create --package nvidia-docker2 -v "$REVISION" "v$REVISION" && \ +RUN dch --create --package nvidia-docker2 -v "$REVISION" "v$REVISION" -D "$DISTRIB" && \ dch -r "" CMD debuild --preserve-env --dpkg-buildpackage-hook='sh debian/prepare' -i -us -uc -b && \ diff --git a/debian/control b/debian/control index 59d792c..3851189 100644 --- a/debian/control +++ b/debian/control @@ -1,5 +1,5 @@ Source: nvidia-docker2 -Section: devel +Section: @SECTION@utils Priority: optional Maintainer: NVIDIA CORPORATION Standards-Version: 3.9.8 @@ -12,7 +12,7 @@ Package: nvidia-docker2 Architecture: all Breaks: nvidia-docker Replaces: nvidia-docker -Depends: ${misc:Depends}, nvidia-container-runtime (= #RUNTIME_VERSION#), docker-ce (= #DOCKER_VERSION#) | docker-ee (= #DOCKER_VERSION#) | docker-engine (= #DOCKER_VERSION#) +Depends: ${misc:Depends}, nvidia-container-runtime (= @RUNTIME_VERSION@), docker-ce (= @DOCKER_VERSION@) | docker-ee (= @DOCKER_VERSION@) | docker-engine (= @DOCKER_VERSION@) Description: nvidia-docker CLI wrapper Replaces nvidia-docker with a new implementation based on nvidia-container-runtime diff --git a/debian/prepare b/debian/prepare index 772c42b..5900ca5 100755 --- a/debian/prepare +++ b/debian/prepare @@ -2,5 +2,6 @@ set -e -sed -i "s/#RUNTIME_VERSION#/${RUNTIME_VERSION}/g" debian/control -sed -i "s/#DOCKER_VERSION#/${DOCKER_VERSION}/g" debian/control +sed -i "s;@SECTION@;${SECTION:+$SECTION/};g" debian/control +sed -i "s;@RUNTIME_VERSION@;${RUNTIME_VERSION};g" debian/control +sed -i "s;@DOCKER_VERSION@;${DOCKER_VERSION};g" debian/control From df28bb46000ed5328e5614f54c2ae9845738c9bb Mon Sep 17 00:00:00 2001 From: Felix Abecassis Date: Wed, 6 Sep 2017 16:50:50 -0700 Subject: [PATCH 04/11] Fix release number for the rpm packages --- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 3712b3c..03f47ec 100644 --- a/Makefile +++ b/Makefile @@ -58,25 +58,25 @@ centos7: 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-centos7 $(DOCKER) run --rm -v $(DIST_DIR)/xenial:/dist:Z nvidia-docker2:$@ 17.06.2.ce-centos7: - $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-17.06.2.1" \ + $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-1.docker17.06.2" \ --build-arg DOCKER_VERSION="17.06.2.ce" \ --build-arg PKG_VERS="$(VERSION)" \ - --build-arg PKG_REV="17.06.2.ce.$(PKG_REV)" \ + --build-arg PKG_REV="$(PKG_REV).docker17.06.2.ce" \ -t nvidia-docker2:$@ -f Dockerfile.centos7 . $(DOCKER) run --rm -v $(DIST_DIR)/centos7:/dist:Z nvidia-docker2:$@ 17.06.1.ce-centos7: - $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-17.06.1.1" \ + $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-1.docker17.06.1" \ --build-arg DOCKER_VERSION="17.06.1.ce" \ --build-arg PKG_VERS="$(VERSION)" \ - --build-arg PKG_REV="17.06.1.ce.$(PKG_REV)" \ + --build-arg PKG_REV="$(PKG_REV).docker17.06.1.ce" \ -t nvidia-docker2:$@ -f Dockerfile.centos7 . $(DOCKER) run --rm -v $(DIST_DIR)/centos7:/dist:Z nvidia-docker2:$@ 17.03.2.ce-centos7: - $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-17.03.2.1" \ + $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-1.docker17.03.2" \ --build-arg DOCKER_VERSION="17.03.2.ce" \ --build-arg PKG_VERS="$(VERSION)" \ - --build-arg PKG_REV="17.03.2.ce.$(PKG_REV)" \ + --build-arg PKG_REV="$(PKG_REV).docker17.03.2.ce" \ -t nvidia-docker2:$@ -f Dockerfile.centos7 . $(DOCKER) run --rm -v $(DIST_DIR)/centos7:/dist:Z nvidia-docker2:$@ From e4ca89ea44855e8ada1c144d784946fac432520d Mon Sep 17 00:00:00 2001 From: Felix Abecassis Date: Wed, 27 Sep 2017 20:30:56 -0700 Subject: [PATCH 05/11] Add support for 17.09.0 --- Makefile | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 03f47ec..8dc22b2 100644 --- a/Makefile +++ b/Makefile @@ -13,9 +13,17 @@ DIST_DIR := $(CURDIR)/dist all: xenial centos7 -xenial: 17.06.2-xenial 17.06.1-xenial 17.03.2-xenial 1.13.1-xenial 1.12.6-xenial +xenial: 17.09.0-xenial 17.06.2-xenial 17.06.1-xenial 17.03.2-xenial 1.13.1-xenial 1.12.6-xenial -centos7: 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-centos7 +centos7: 17.09.0.ce-centos7 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-centos7 + +17.09.0-xenial: + $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)+docker17.09.0-1" \ + --build-arg DOCKER_VERSION="17.09.0~ce-0~ubuntu" \ + --build-arg PKG_VERS="$(VERSION)+docker17.09.0" \ + --build-arg PKG_REV="$(PKG_REV)" \ + -t nvidia-docker2:$@ -f Dockerfile.xenial . + $(DOCKER) run --rm -v $(DIST_DIR)/xenial:/dist:Z nvidia-docker2:$@ 17.06.2-xenial: $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)+docker17.06.2-1" \ @@ -57,6 +65,14 @@ centos7: 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-centos7 -t nvidia-docker2:$@ -f Dockerfile.xenial . $(DOCKER) run --rm -v $(DIST_DIR)/xenial:/dist:Z nvidia-docker2:$@ +17.09.0.ce-centos7: + $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-1.docker17.09.0" \ + --build-arg DOCKER_VERSION="17.09.0.ce" \ + --build-arg PKG_VERS="$(VERSION)" \ + --build-arg PKG_REV="$(PKG_REV).docker17.09.0.ce" \ + -t nvidia-docker2:$@ -f Dockerfile.centos7 . + $(DOCKER) run --rm -v $(DIST_DIR)/centos7:/dist:Z nvidia-docker2:$@ + 17.06.2.ce-centos7: $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-1.docker17.06.2" \ --build-arg DOCKER_VERSION="17.06.2.ce" \ From b9294ab2b478f841b803faf10277d5a530784e8e Mon Sep 17 00:00:00 2001 From: Felix Abecassis Date: Fri, 6 Oct 2017 17:50:12 -0700 Subject: [PATCH 06/11] Document the 2.0 alpha release --- LICENSE | 25 ++++++++++++++ README.md | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..43ba609 --- /dev/null +++ b/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of NVIDIA CORPORATION nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index bb2a664..aeb6951 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,100 @@ # Docker Engine Utility for NVIDIA GPUs -## Transition to version 2.0 +[![GitHub license](https://img.shields.io/badge/license-New%20BSD-blue.svg?style=flat-square)](https://raw.githubusercontent.com/NVIDIA/nvidia-docker/master/LICENSE) +[![Package repository](https://img.shields.io/badge/packages-repository-b956e8.svg?style=flat-square)](https://nvidia.github.io/nvidia-docker) + +![nvidia-gpu-docker](https://cloud.githubusercontent.com/assets/3028125/12213714/5b208976-b632-11e5-8406-38d379ec46aa.png) + +This branch contains version 2.0 of the nvidia-docker utility. + +**Warning: Version 2.0 is in alpha state, it is not intended to be used in production systems.** + +## Differences with 1.0 +* Doesn't require wrapping the Docker CLI, +* Doesn't require starting a separate daemon, +* GPU isolation is now achieved with environment variable `NVIDIA_VISIBLE_DEVICES`, +* Can enable GPU support for any Docker image. Not just the ones based on our official CUDA images, +* Package repositories are available for Ubuntu and CentOS, +* Uses a new implementation based on [libnvidia-container](https://github.com/NVIDIA/libnvidia-container). + +## Removing nvidia-docker 1.0 + +Version 1.0 of the nvidia-docker package must be cleanly removed before continuing. +You must stop and remove **all** containers started with nvidia-docker 1.0. + +#### Ubuntu distributions +```sh +docker volume ls -q -f driver=nvidia-docker | xargs -r -I{} -n1 docker ps -q -a -f volume={} | xargs -r docker rm -f +sudo apt-get purge nvidia-docker +``` + +#### CentOS distributions + +``` +docker volume ls -q -f driver=nvidia-docker | xargs -r -I{} -n1 docker ps -q -a -f volume={} | xargs -r docker rm -f +sudo yum remove nvidia-docker +``` + +## Installation + +#### Ubuntu distributions + +1. Install the repository for your distribution by following the instructions [here](http://nvidia.github.io/nvidia-docker/). +2. Install the `nvidia-docker2` package and restart the Docker daemon: +``` +sudo apt-get install nvidia-docker2 +sudo pkill -SIGHUP dockerd +``` + +#### CentOS distributions +1. Install the repository for your distribution by following the instructions [here](http://nvidia.github.io/nvidia-docker/). +2. Install the `nvidia-docker2` package and restart the Docker daemon: +``` +sudo yum install nvidia-docker2 +sudo pkill -SIGHUP dockerd +``` + +## Usage + +#### NVIDIA runtime +nvidia-docker 2.0 registers a new container runtime to the Docker daemon. +You must select the `nvidia` runtime when using `docker run`: +``` +docker run --runtime=nvidia --rm nvidia/cuda nvidia-smi +``` + +#### GPU isolation +Set the environment variable `NVIDIA_VISIBLE_DEVICES` in the container: +``` +docker run --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=0 --rm nvidia/cuda nvidia-smi +``` + +#### Non-CUDA image: +Setting `NVIDIA_VISIBLE_DEVICES` will enable GPU support for any container image: +``` +docker run --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all --rm debian:stretch nvidia-smi +``` + +## Advanced + +#### Backward compatibility + +To help transitioning code from 1.0 to 2.0, a bash script is provided in `/usr/bin/nvidia-docker` for backward compatibility. +It will automatically inject the `--runtime=nvidia` argument and convert `NV_GPU` to `NVIDIA_VISIBLE_DEVICES`. + +#### Environment variables +The behavior of the runtime can be modified through environment variables (such as `NVIDIA_VISIBLE_DEVICES`). +Those environment variables are consumed by [nvidia-container-runtime](https://github.com/nvidia/nvidia-container-runtime) and are documented [here](https://github.com/nvidia/nvidia-container-runtime#environment-variables-oci-spec). +Our official CUDA images use default values for these variables. + +#### Default runtime +The default runtime used by the DockerĀ® Engine is [runc](https://github.com/opencontainers/runc), our runtime can become the default one by configuring the docker daemon with `--default-runtime=nvidia`. +Doing so will remove the need to add the `--runtime=nvidia` argument to `docker run`. +It is also the only way to have GPU access during `docker build`. + +## Issues and Contributing + +A signed copy of the [Contributor License Agreement](https://raw.githubusercontent.com/NVIDIA/nvidia-docker/master/CLA) needs to be provided to digits@nvidia.com before any change can be accepted. + +* Please let us know by [filing a new issue](https://github.com/NVIDIA/nvidia-docker/issues/new) +* You can contribute by opening a [pull request](https://help.github.com/articles/using-pull-requests/) From b6f861ef35e8653d65d96a3748228f54e88d316a Mon Sep 17 00:00:00 2001 From: Felix Abecassis Date: Tue, 17 Oct 2017 17:07:01 -0400 Subject: [PATCH 07/11] Add support for Red Hat's fork of Docker --- Dockerfile.centos7 | 3 +++ Makefile | 11 ++++++++++- rpm/SPECS/nvidia-docker2.spec | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Dockerfile.centos7 b/Dockerfile.centos7 index 147f17c..ddff66f 100644 --- a/Dockerfile.centos7 +++ b/Dockerfile.centos7 @@ -10,11 +10,13 @@ ARG PKG_VERS ARG PKG_REV ARG RUNTIME_VERSION ARG DOCKER_VERSION +ARG DOCKER_PKG=docker-ce ENV VERSION $PKG_VERS ENV RELEASE $PKG_REV ENV RUNTIME_VERSION $RUNTIME_VERSION ENV DOCKER_VERSION $DOCKER_VERSION +ENV DOCKER_PKG $DOCKER_PKG # output directory ENV DIST_DIR=/tmp/nvidia-container-runtime-$PKG_VERS/SOURCES @@ -32,5 +34,6 @@ CMD rpmbuild --clean -bb \ -D "release $RELEASE" \ -D "runtime_version $RUNTIME_VERSION" \ -D "docker_version $DOCKER_VERSION" \ + -D "docker_pkg $DOCKER_PKG" \ SPECS/nvidia-docker2.spec && \ mv RPMS/noarch/*.rpm /dist diff --git a/Makefile b/Makefile index 8dc22b2..fbc5921 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ all: xenial centos7 xenial: 17.09.0-xenial 17.06.2-xenial 17.06.1-xenial 17.03.2-xenial 1.13.1-xenial 1.12.6-xenial -centos7: 17.09.0.ce-centos7 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-centos7 +centos7: 17.09.0.ce-centos7 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-centos7 1.12.6-centos7 17.09.0-xenial: $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)+docker17.09.0-1" \ @@ -96,3 +96,12 @@ centos7: 17.09.0.ce-centos7 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-cen --build-arg PKG_REV="$(PKG_REV).docker17.03.2.ce" \ -t nvidia-docker2:$@ -f Dockerfile.centos7 . $(DOCKER) run --rm -v $(DIST_DIR)/centos7:/dist:Z nvidia-docker2:$@ + +1.12.6-centos7: + $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-1.docker1.12.6" \ + --build-arg DOCKER_VERSION="2:1.12.6" \ + --build-arg DOCKER_PKG="docker" \ + --build-arg PKG_VERS="$(VERSION)" \ + --build-arg PKG_REV="$(PKG_REV).docker1.12.6" \ + -t nvidia-docker2:$@ -f Dockerfile.centos7 . + $(DOCKER) run --rm -v $(DIST_DIR)/centos7:/dist:Z nvidia-docker2:$@ diff --git a/rpm/SPECS/nvidia-docker2.spec b/rpm/SPECS/nvidia-docker2.spec index 5e485a2..d7238b0 100644 --- a/rpm/SPECS/nvidia-docker2.spec +++ b/rpm/SPECS/nvidia-docker2.spec @@ -17,7 +17,7 @@ Source2: LICENSE Conflicts: nvidia-docker Requires: nvidia-container-runtime = %{runtime_version} -Requires: docker-ce = %{docker_version} +Requires: %{docker_pkg} = %{docker_version} %description Replaces nvidia-docker with a new implementation based on nvidia-container-runtime From ba6a6555768a3293aafe2f77b8490bf4f0c50dbd Mon Sep 17 00:00:00 2001 From: Felix Abecassis Date: Mon, 30 Oct 2017 14:34:54 -0700 Subject: [PATCH 08/11] Do not depend on non-existing Docker packages For deb packages, we can't have a generic way to express the dependency on the docker packages --- Dockerfile.centos7 | 3 --- Makefile | 23 +++++++++++------------ debian/control | 2 +- rpm/SPECS/nvidia-docker2.spec | 2 +- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/Dockerfile.centos7 b/Dockerfile.centos7 index ddff66f..147f17c 100644 --- a/Dockerfile.centos7 +++ b/Dockerfile.centos7 @@ -10,13 +10,11 @@ ARG PKG_VERS ARG PKG_REV ARG RUNTIME_VERSION ARG DOCKER_VERSION -ARG DOCKER_PKG=docker-ce ENV VERSION $PKG_VERS ENV RELEASE $PKG_REV ENV RUNTIME_VERSION $RUNTIME_VERSION ENV DOCKER_VERSION $DOCKER_VERSION -ENV DOCKER_PKG $DOCKER_PKG # output directory ENV DIST_DIR=/tmp/nvidia-container-runtime-$PKG_VERS/SOURCES @@ -34,6 +32,5 @@ CMD rpmbuild --clean -bb \ -D "release $RELEASE" \ -D "runtime_version $RUNTIME_VERSION" \ -D "docker_version $DOCKER_VERSION" \ - -D "docker_pkg $DOCKER_PKG" \ SPECS/nvidia-docker2.spec && \ mv RPMS/noarch/*.rpm /dist diff --git a/Makefile b/Makefile index fbc5921..8f37a0f 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ centos7: 17.09.0.ce-centos7 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-cen 17.09.0-xenial: $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)+docker17.09.0-1" \ - --build-arg DOCKER_VERSION="17.09.0~ce-0~ubuntu" \ + --build-arg DOCKER_VERSION="docker-ce (= 17.09.0~ce-0~ubuntu) | docker-ee (= 17.09.0~ee-0~ubuntu)" \ --build-arg PKG_VERS="$(VERSION)+docker17.09.0" \ --build-arg PKG_REV="$(PKG_REV)" \ -t nvidia-docker2:$@ -f Dockerfile.xenial . @@ -27,7 +27,7 @@ centos7: 17.09.0.ce-centos7 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-cen 17.06.2-xenial: $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)+docker17.06.2-1" \ - --build-arg DOCKER_VERSION="17.06.2~ce-0~ubuntu" \ + --build-arg DOCKER_VERSION="docker-ce (= 17.06.2~ce-0~ubuntu) | docker-ee (= 17.06.2~ee-0~ubuntu)" \ --build-arg PKG_VERS="$(VERSION)+docker17.06.2" \ --build-arg PKG_REV="$(PKG_REV)" \ -t nvidia-docker2:$@ -f Dockerfile.xenial . @@ -35,7 +35,7 @@ centos7: 17.09.0.ce-centos7 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-cen 17.06.1-xenial: $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)+docker17.06.1-1" \ - --build-arg DOCKER_VERSION="17.06.1~ce-0~ubuntu" \ + --build-arg DOCKER_VERSION="docker-ce (= 17.06.1~ce-0~ubuntu) | docker-ee (= 17.06.1~ee-0~ubuntu)" \ --build-arg PKG_VERS="$(VERSION)+docker17.06.1" \ --build-arg PKG_REV="$(PKG_REV)" \ -t nvidia-docker2:$@ -f Dockerfile.xenial . @@ -43,7 +43,7 @@ centos7: 17.09.0.ce-centos7 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-cen 17.03.2-xenial: $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)+docker17.03.2-1" \ - --build-arg DOCKER_VERSION="17.03.2~ce-0~ubuntu-xenial" \ + --build-arg DOCKER_VERSION="docker-ce (= 17.03.2~ce-0~ubuntu-xenial) | docker-ee (= 17.03.2~ee-0~ubuntu-xenial)" \ --build-arg PKG_VERS="$(VERSION)+docker17.03.2" \ --build-arg PKG_REV="$(PKG_REV)" \ -t nvidia-docker2:$@ -f Dockerfile.xenial . @@ -51,7 +51,7 @@ centos7: 17.09.0.ce-centos7 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-cen 1.13.1-xenial: $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)+docker1.13.1-1" \ - --build-arg DOCKER_VERSION="1.13.1-0~ubuntu-xenial" \ + --build-arg DOCKER_VERSION="docker-engine(= 1.13.1-0~ubuntu-xenial)" \ --build-arg PKG_VERS="$(VERSION)+docker1.13.1" \ --build-arg PKG_REV="$(PKG_REV)" \ -t nvidia-docker2:$@ -f Dockerfile.xenial . @@ -59,7 +59,7 @@ centos7: 17.09.0.ce-centos7 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-cen 1.12.6-xenial: $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)+docker1.12.6-1" \ - --build-arg DOCKER_VERSION="1.12.6-0~ubuntu-xenial" \ + --build-arg DOCKER_VERSION="docker-engine (= 1.12.6-0~ubuntu-xenial) | docker.io (= 1.12.6-0ubuntu1~16.04.1)" \ --build-arg PKG_VERS="$(VERSION)+docker1.12.6" \ --build-arg PKG_REV="$(PKG_REV)" \ -t nvidia-docker2:$@ -f Dockerfile.xenial . @@ -67,7 +67,7 @@ centos7: 17.09.0.ce-centos7 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-cen 17.09.0.ce-centos7: $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-1.docker17.09.0" \ - --build-arg DOCKER_VERSION="17.09.0.ce" \ + --build-arg DOCKER_VERSION="docker-ce = 17.09.0.ce" \ --build-arg PKG_VERS="$(VERSION)" \ --build-arg PKG_REV="$(PKG_REV).docker17.09.0.ce" \ -t nvidia-docker2:$@ -f Dockerfile.centos7 . @@ -75,7 +75,7 @@ centos7: 17.09.0.ce-centos7 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-cen 17.06.2.ce-centos7: $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-1.docker17.06.2" \ - --build-arg DOCKER_VERSION="17.06.2.ce" \ + --build-arg DOCKER_VERSION="docker-ce = 17.06.2.ce" \ --build-arg PKG_VERS="$(VERSION)" \ --build-arg PKG_REV="$(PKG_REV).docker17.06.2.ce" \ -t nvidia-docker2:$@ -f Dockerfile.centos7 . @@ -83,7 +83,7 @@ centos7: 17.09.0.ce-centos7 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-cen 17.06.1.ce-centos7: $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-1.docker17.06.1" \ - --build-arg DOCKER_VERSION="17.06.1.ce" \ + --build-arg DOCKER_VERSION="docker-ce = 17.06.1.ce" \ --build-arg PKG_VERS="$(VERSION)" \ --build-arg PKG_REV="$(PKG_REV).docker17.06.1.ce" \ -t nvidia-docker2:$@ -f Dockerfile.centos7 . @@ -91,7 +91,7 @@ centos7: 17.09.0.ce-centos7 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-cen 17.03.2.ce-centos7: $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-1.docker17.03.2" \ - --build-arg DOCKER_VERSION="17.03.2.ce" \ + --build-arg DOCKER_VERSION="docker-ce = 17.03.2.ce" \ --build-arg PKG_VERS="$(VERSION)" \ --build-arg PKG_REV="$(PKG_REV).docker17.03.2.ce" \ -t nvidia-docker2:$@ -f Dockerfile.centos7 . @@ -99,8 +99,7 @@ centos7: 17.09.0.ce-centos7 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-cen 1.12.6-centos7: $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-1.docker1.12.6" \ - --build-arg DOCKER_VERSION="2:1.12.6" \ - --build-arg DOCKER_PKG="docker" \ + --build-arg DOCKER_VERSION="docker = 2:1.12.6" \ --build-arg PKG_VERS="$(VERSION)" \ --build-arg PKG_REV="$(PKG_REV).docker1.12.6" \ -t nvidia-docker2:$@ -f Dockerfile.centos7 . diff --git a/debian/control b/debian/control index 3851189..2cc6dd8 100644 --- a/debian/control +++ b/debian/control @@ -12,7 +12,7 @@ Package: nvidia-docker2 Architecture: all Breaks: nvidia-docker Replaces: nvidia-docker -Depends: ${misc:Depends}, nvidia-container-runtime (= @RUNTIME_VERSION@), docker-ce (= @DOCKER_VERSION@) | docker-ee (= @DOCKER_VERSION@) | docker-engine (= @DOCKER_VERSION@) +Depends: ${misc:Depends}, nvidia-container-runtime (= @RUNTIME_VERSION@), @DOCKER_VERSION@ Description: nvidia-docker CLI wrapper Replaces nvidia-docker with a new implementation based on nvidia-container-runtime diff --git a/rpm/SPECS/nvidia-docker2.spec b/rpm/SPECS/nvidia-docker2.spec index d7238b0..f0b1474 100644 --- a/rpm/SPECS/nvidia-docker2.spec +++ b/rpm/SPECS/nvidia-docker2.spec @@ -17,7 +17,7 @@ Source2: LICENSE Conflicts: nvidia-docker Requires: nvidia-container-runtime = %{runtime_version} -Requires: %{docker_pkg} = %{docker_version} +Requires: %{docker_version} %description Replaces nvidia-docker with a new implementation based on nvidia-container-runtime From 38f9d6369b5bc414b647d0bf224083b77095d8d1 Mon Sep 17 00:00:00 2001 From: Felix Abecassis Date: Mon, 30 Oct 2017 16:12:53 -0700 Subject: [PATCH 09/11] Set version to 2.0.1 Bump dependency on nvidia-container-runtime to v1.1.0 --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8f37a0f..c31200b 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,9 @@ DOCKER ?= docker -VERSION := 2.0.0 +VERSION := 2.0.1 PKG_REV := 1 -RUNTIME_VERSION := 1.0.0 +RUNTIME_VERSION := 1.1.0 DIST_DIR := $(CURDIR)/dist From 5d2a1f141e7f2cb843de161133d4632fe1b6c506 Mon Sep 17 00:00:00 2001 From: Felix Abecassis Date: Mon, 30 Oct 2017 16:58:49 -0700 Subject: [PATCH 10/11] Drop support for 17.06.1 --- Makefile | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index c31200b..ebf0b0e 100644 --- a/Makefile +++ b/Makefile @@ -13,9 +13,9 @@ DIST_DIR := $(CURDIR)/dist all: xenial centos7 -xenial: 17.09.0-xenial 17.06.2-xenial 17.06.1-xenial 17.03.2-xenial 1.13.1-xenial 1.12.6-xenial +xenial: 17.09.0-xenial 17.06.2-xenial 17.03.2-xenial 1.13.1-xenial 1.12.6-xenial -centos7: 17.09.0.ce-centos7 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-centos7 1.12.6-centos7 +centos7: 17.09.0.ce-centos7 17.06.2.ce-centos7 17.03.2.ce-centos7 1.12.6-centos7 17.09.0-xenial: $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)+docker17.09.0-1" \ @@ -33,14 +33,6 @@ centos7: 17.09.0.ce-centos7 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-cen -t nvidia-docker2:$@ -f Dockerfile.xenial . $(DOCKER) run --rm -v $(DIST_DIR)/xenial:/dist:Z nvidia-docker2:$@ -17.06.1-xenial: - $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)+docker17.06.1-1" \ - --build-arg DOCKER_VERSION="docker-ce (= 17.06.1~ce-0~ubuntu) | docker-ee (= 17.06.1~ee-0~ubuntu)" \ - --build-arg PKG_VERS="$(VERSION)+docker17.06.1" \ - --build-arg PKG_REV="$(PKG_REV)" \ - -t nvidia-docker2:$@ -f Dockerfile.xenial . - $(DOCKER) run --rm -v $(DIST_DIR)/xenial:/dist:Z nvidia-docker2:$@ - 17.03.2-xenial: $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)+docker17.03.2-1" \ --build-arg DOCKER_VERSION="docker-ce (= 17.03.2~ce-0~ubuntu-xenial) | docker-ee (= 17.03.2~ee-0~ubuntu-xenial)" \ @@ -81,14 +73,6 @@ centos7: 17.09.0.ce-centos7 17.06.2.ce-centos7 17.06.1.ce-centos7 17.03.2.ce-cen -t nvidia-docker2:$@ -f Dockerfile.centos7 . $(DOCKER) run --rm -v $(DIST_DIR)/centos7:/dist:Z nvidia-docker2:$@ -17.06.1.ce-centos7: - $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-1.docker17.06.1" \ - --build-arg DOCKER_VERSION="docker-ce = 17.06.1.ce" \ - --build-arg PKG_VERS="$(VERSION)" \ - --build-arg PKG_REV="$(PKG_REV).docker17.06.1.ce" \ - -t nvidia-docker2:$@ -f Dockerfile.centos7 . - $(DOCKER) run --rm -v $(DIST_DIR)/centos7:/dist:Z nvidia-docker2:$@ - 17.03.2.ce-centos7: $(DOCKER) build --build-arg RUNTIME_VERSION="$(RUNTIME_VERSION)-1.docker17.03.2" \ --build-arg DOCKER_VERSION="docker-ce = 17.03.2.ce" \ From 7856177eb5b90c49affc9655db2dc3d20db4727f Mon Sep 17 00:00:00 2001 From: Felix Abecassis Date: Wed, 1 Nov 2017 10:37:27 -0700 Subject: [PATCH 11/11] Document the conflict with /etc/docker/daemon.json --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index aeb6951..9d3c556 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,9 @@ sudo yum remove nvidia-docker ## Installation +**If you have a custom `/etc/docker/daemon.json`, the `nvidia-docker2` package will override it.** +**In this case, it is recommended to install [nvidia-container-runtime](https://github.com/nvidia/nvidia-container-runtime#installation) instead and register the new runtime manually.** + #### Ubuntu distributions 1. Install the repository for your distribution by following the instructions [here](http://nvidia.github.io/nvidia-docker/). @@ -82,16 +85,16 @@ docker run --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all --rm debian:stretch nv To help transitioning code from 1.0 to 2.0, a bash script is provided in `/usr/bin/nvidia-docker` for backward compatibility. It will automatically inject the `--runtime=nvidia` argument and convert `NV_GPU` to `NVIDIA_VISIBLE_DEVICES`. -#### Environment variables -The behavior of the runtime can be modified through environment variables (such as `NVIDIA_VISIBLE_DEVICES`). -Those environment variables are consumed by [nvidia-container-runtime](https://github.com/nvidia/nvidia-container-runtime) and are documented [here](https://github.com/nvidia/nvidia-container-runtime#environment-variables-oci-spec). -Our official CUDA images use default values for these variables. - #### Default runtime The default runtime used by the DockerĀ® Engine is [runc](https://github.com/opencontainers/runc), our runtime can become the default one by configuring the docker daemon with `--default-runtime=nvidia`. Doing so will remove the need to add the `--runtime=nvidia` argument to `docker run`. It is also the only way to have GPU access during `docker build`. +#### Environment variables +The behavior of the runtime can be modified through environment variables (such as `NVIDIA_VISIBLE_DEVICES`). +Those environment variables are consumed by [nvidia-container-runtime](https://github.com/nvidia/nvidia-container-runtime) and are documented [here](https://github.com/nvidia/nvidia-container-runtime#environment-variables-oci-spec). +Our official CUDA images use default values for these variables. + ## Issues and Contributing A signed copy of the [Contributor License Agreement](https://raw.githubusercontent.com/NVIDIA/nvidia-docker/master/CLA) needs to be provided to digits@nvidia.com before any change can be accepted.