Initial commit for branch 2.0

This commit is contained in:
Felix Abecassis 2017-09-05 19:16:49 -07:00
commit 376a0efd0e
15 changed files with 317 additions and 0 deletions

36
Dockerfile.centos7 Normal file
View file

@ -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

38
Dockerfile.xenial Normal file
View file

@ -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

66
Makefile Normal file
View file

@ -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:$@

3
README.md Normal file
View file

@ -0,0 +1,3 @@
# Docker Engine Utility for NVIDIA GPUs
## Transition to version 2.0

8
daemon.json Normal file
View file

@ -0,0 +1,8 @@
{
"runtimes": {
"nvidia": {
"path": "/usr/bin/nvidia-container-runtime",
"runtimeArgs": []
}
}
}

1
debian/compat vendored Normal file
View file

@ -0,0 +1 @@
9

18
debian/control vendored Normal file
View file

@ -0,0 +1,18 @@
Source: nvidia-docker2
Section: devel
Priority: optional
Maintainer: NVIDIA CORPORATION <cudatools@nvidia.com>
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

35
debian/copyright vendored Normal file
View file

@ -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 <cudatools@nvidia.com>
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.

2
debian/nvidia-docker2.install vendored Normal file
View file

@ -0,0 +1,2 @@
daemon.json /etc/docker
nvidia-* /usr/bin

View file

@ -0,0 +1,2 @@
new-package-should-close-itp-bug
binary-without-manpage

6
debian/prepare vendored Executable file
View file

@ -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

7
debian/rules vendored Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/make -f
# -*- makefile -*-
#export DH_VERBOSE=1
%:
dh $@

31
nvidia-docker Executable file
View file

@ -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 "$@"

25
rpm/SOURCES/LICENSE Normal file
View file

@ -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.

View file

@ -0,0 +1,39 @@
Name: nvidia-docker2
Version: %{version}
Release: %{release}
BuildArch: noarch
Group: Development Tools
Vendor: NVIDIA CORPORATION
Packager: NVIDIA CORPORATION <cudatools@nvidia.com>
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