1# This file describes the standard way to build Docker, using docker 2# 3# Usage: 4# 5# # Assemble the full dev environment. This is slow the first time. 6# docker build -t docker . 7# 8# # Mount your source in an interactive container for quick testing: 9# docker run -v `pwd`:/go/src/github.com/docker/docker --privileged -i -t docker bash 10# 11# # Run the test suite: 12# docker run -e DOCKER_GITCOMMIT=foo --privileged docker hack/make.sh test-unit test-integration test-docker-py 13# 14# # Publish a release: 15# docker run --privileged \ 16# -e AWS_S3_BUCKET=baz \ 17# -e AWS_ACCESS_KEY=foo \ 18# -e AWS_SECRET_KEY=bar \ 19# -e GPG_PASSPHRASE=gloubiboulga \ 20# docker hack/release.sh 21# 22# Note: AppArmor used to mess with privileged mode, but this is no longer 23# the case. Therefore, you don't have to disable it anymore. 24# 25 26FROM debian:stretch 27 28# allow replacing httpredir or deb mirror 29ARG APT_MIRROR=deb.debian.org 30RUN sed -ri "s/(httpredir|deb).debian.org/$APT_MIRROR/g" /etc/apt/sources.list 31 32# Packaged dependencies 33RUN apt-get update && apt-get install -y \ 34 apparmor \ 35 apt-utils \ 36 aufs-tools \ 37 automake \ 38 bash-completion \ 39 binutils-mingw-w64 \ 40 bsdmainutils \ 41 btrfs-tools \ 42 build-essential \ 43 cmake \ 44 createrepo \ 45 curl \ 46 dpkg-sig \ 47 gcc-mingw-w64 \ 48 git \ 49 iptables \ 50 jq \ 51 less \ 52 libapparmor-dev \ 53 libcap-dev \ 54 libdevmapper-dev \ 55 libnet-dev \ 56 libnl-3-dev \ 57 libprotobuf-c0-dev \ 58 libprotobuf-dev \ 59 libseccomp-dev \ 60 libsystemd-dev \ 61 libtool \ 62 libudev-dev \ 63 mercurial \ 64 net-tools \ 65 pkg-config \ 66 protobuf-compiler \ 67 protobuf-c-compiler \ 68 python-backports.ssl-match-hostname \ 69 python-dev \ 70 python-mock \ 71 python-pip \ 72 python-requests \ 73 python-setuptools \ 74 python-websocket \ 75 python-wheel \ 76 tar \ 77 thin-provisioning-tools \ 78 vim \ 79 vim-common \ 80 xfsprogs \ 81 zip \ 82 --no-install-recommends \ 83 && pip install awscli==1.10.15 84 85# Install Go 86# IMPORTANT: If the version of Go is updated, the Windows to Linux CI machines 87# will need updating, to avoid errors. Ping #docker-maintainers on IRC 88# with a heads-up. 89# IMPORTANT: When updating this please note that stdlib archive/tar pkg is vendored 90ENV GO_VERSION 1.9.2 91RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" \ 92 | tar -xzC /usr/local 93 94ENV PATH /go/bin:/usr/local/go/bin:$PATH 95ENV GOPATH /go 96 97# Install CRIU for checkpoint/restore support 98ENV CRIU_VERSION 3.6 99RUN mkdir -p /usr/src/criu \ 100 && curl -sSL https://github.com/checkpoint-restore/criu/archive/v${CRIU_VERSION}.tar.gz | tar -C /usr/src/criu/ -xz --strip-components=1 \ 101 && cd /usr/src/criu \ 102 && make \ 103 && make install-criu 104 105# Install two versions of the registry. The first is an older version that 106# only supports schema1 manifests. The second is a newer version that supports 107# both. This allows integration-cli tests to cover push/pull with both schema1 108# and schema2 manifests. 109ENV REGISTRY_COMMIT_SCHEMA1 ec87e9b6971d831f0eff752ddb54fb64693e51cd 110ENV REGISTRY_COMMIT 47a064d4195a9b56133891bbb13620c3ac83a827 111RUN set -x \ 112 && export GOPATH="$(mktemp -d)" \ 113 && git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \ 114 && (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \ 115 && GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \ 116 go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \ 117 && (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT_SCHEMA1") \ 118 && GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \ 119 go build -o /usr/local/bin/registry-v2-schema1 github.com/docker/distribution/cmd/registry \ 120 && rm -rf "$GOPATH" 121 122# Install notary and notary-server 123ENV NOTARY_VERSION v0.5.0 124RUN set -x \ 125 && export GOPATH="$(mktemp -d)" \ 126 && git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \ 127 && (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_VERSION") \ 128 && GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \ 129 go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \ 130 && GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \ 131 go build -o /usr/local/bin/notary github.com/docker/notary/cmd/notary \ 132 && rm -rf "$GOPATH" 133 134# Get the "docker-py" source so we can run their integration tests 135ENV DOCKER_PY_COMMIT 1d6b5b203222ba5df7dedfcd1ee061a452f99c8a 136# To run integration tests docker-pycreds is required. 137RUN git clone https://github.com/docker/docker-py.git /docker-py \ 138 && cd /docker-py \ 139 && git checkout -q $DOCKER_PY_COMMIT \ 140 && pip install docker-pycreds==0.2.1 \ 141 && pip install -r test-requirements.txt 142 143# Install yamllint for validating swagger.yaml 144RUN pip install yamllint==1.5.0 145 146# Install go-swagger for validating swagger.yaml 147ENV GO_SWAGGER_COMMIT c28258affb0b6251755d92489ef685af8d4ff3eb 148RUN git clone https://github.com/go-swagger/go-swagger.git /go/src/github.com/go-swagger/go-swagger \ 149 && (cd /go/src/github.com/go-swagger/go-swagger && git checkout -q $GO_SWAGGER_COMMIT) \ 150 && go install -v github.com/go-swagger/go-swagger/cmd/swagger 151 152# Set user.email so crosbymichael's in-container merge commits go smoothly 153RUN git config --global user.email 'docker-dummy@example.com' 154 155# Add an unprivileged user to be used for tests which need it 156RUN groupadd -r docker 157RUN useradd --create-home --gid docker unprivilegeduser 158 159VOLUME /var/lib/docker 160WORKDIR /go/src/github.com/docker/docker 161ENV DOCKER_BUILDTAGS apparmor seccomp selinux 162 163# Let us use a .bashrc file 164RUN ln -sfv $PWD/.bashrc ~/.bashrc 165# Add integration helps to bashrc 166RUN echo "source $PWD/hack/make/.integration-test-helpers" >> /etc/bash.bashrc 167 168# Get useful and necessary Hub images so we can "docker load" locally instead of pulling 169COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/ 170RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \ 171 buildpack-deps:jessie@sha256:85b379ec16065e4fe4127eb1c5fb1bcc03c559bd36dbb2e22ff496de55925fa6 \ 172 busybox:latest@sha256:32f093055929dbc23dec4d03e09dfe971f5973a9ca5cf059cbfb644c206aa83f \ 173 debian:jessie@sha256:72f784399fd2719b4cb4e16ef8e369a39dc67f53d978cd3e2e7bf4e502c7b793 \ 174 hello-world:latest@sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7 175# See also ensureFrozenImagesLinux() in "integration-cli/fixtures_linux_daemon_test.go" (which needs to be updated when adding images to this list) 176 177# Install tomlv, vndr, runc, containerd, tini, docker-proxy dockercli 178# Please edit hack/dockerfile/install-binaries.sh to update them. 179COPY hack/dockerfile/binaries-commits /tmp/binaries-commits 180COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh 181RUN /tmp/install-binaries.sh tomlv vndr runc containerd tini proxy dockercli gometalinter 182ENV PATH=/usr/local/cli:$PATH 183 184# Activate bash completion and include Docker's completion if mounted with DOCKER_BASH_COMPLETION_PATH 185RUN echo "source /usr/share/bash-completion/bash_completion" >> /etc/bash.bashrc 186RUN ln -s /usr/local/completion/bash/docker /etc/bash_completion.d/docker 187 188# Wrap all commands in the "docker-in-docker" script to allow nested containers 189ENTRYPOINT ["hack/dind"] 190 191# Options for hack/validate/gometalinter 192ENV GOMETALINTER_OPTS="--deadline 2m" 193 194# Upload docker source 195COPY . /go/src/github.com/docker/docker 196 197