github.com/go/docker@v1.12.0-rc2/Dockerfile (about) 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 --privileged docker hack/make.sh test 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 26 FROM debian:jessie 27 28 # add zfs ppa 29 RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys E871F18B51E0147C77796AC81196BA81F6B0FC61 \ 30 || apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys E871F18B51E0147C77796AC81196BA81F6B0FC61 31 RUN echo deb http://ppa.launchpad.net/zfs-native/stable/ubuntu trusty main > /etc/apt/sources.list.d/zfs.list 32 33 34 # allow replacing httpredir mirror 35 ARG APT_MIRROR=httpredir.debian.org 36 RUN sed -i s/httpredir.debian.org/$APT_MIRROR/g /etc/apt/sources.list 37 38 # Packaged dependencies 39 RUN apt-get update && apt-get install -y \ 40 apparmor \ 41 apt-utils \ 42 aufs-tools \ 43 automake \ 44 bash-completion \ 45 binutils-mingw-w64 \ 46 bsdmainutils \ 47 btrfs-tools \ 48 build-essential \ 49 clang \ 50 createrepo \ 51 curl \ 52 dpkg-sig \ 53 gcc-mingw-w64 \ 54 git \ 55 iptables \ 56 jq \ 57 libapparmor-dev \ 58 libcap-dev \ 59 libltdl-dev \ 60 libsqlite3-dev \ 61 libsystemd-journal-dev \ 62 libtool \ 63 mercurial \ 64 net-tools \ 65 pkg-config \ 66 python-dev \ 67 python-mock \ 68 python-pip \ 69 python-websocket \ 70 ubuntu-zfs \ 71 xfsprogs \ 72 libzfs-dev \ 73 tar \ 74 zip \ 75 --no-install-recommends \ 76 && pip install awscli==1.10.15 77 # Get lvm2 source for compiling statically 78 ENV LVM2_VERSION 2.02.103 79 RUN mkdir -p /usr/local/lvm2 \ 80 && curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \ 81 | tar -xzC /usr/local/lvm2 --strip-components=1 82 # see https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags 83 84 # Compile and install lvm2 85 RUN cd /usr/local/lvm2 \ 86 && ./configure \ 87 --build="$(gcc -print-multiarch)" \ 88 --enable-static_link \ 89 && make device-mapper \ 90 && make install_device-mapper 91 # see https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL 92 93 # Configure the container for OSX cross compilation 94 ENV OSX_SDK MacOSX10.11.sdk 95 ENV OSX_CROSS_COMMIT 8aa9b71a394905e6c5f4b59e2b97b87a004658a4 96 RUN set -x \ 97 && export OSXCROSS_PATH="/osxcross" \ 98 && git clone https://github.com/tpoechtrager/osxcross.git $OSXCROSS_PATH \ 99 && ( cd $OSXCROSS_PATH && git checkout -q $OSX_CROSS_COMMIT) \ 100 && curl -sSL https://s3.dockerproject.org/darwin/v2/${OSX_SDK}.tar.xz -o "${OSXCROSS_PATH}/tarballs/${OSX_SDK}.tar.xz" \ 101 && UNATTENDED=yes OSX_VERSION_MIN=10.6 ${OSXCROSS_PATH}/build.sh 102 ENV PATH /osxcross/target/bin:$PATH 103 104 # install seccomp: the version shipped in trusty is too old 105 ENV SECCOMP_VERSION 2.3.1 106 RUN set -x \ 107 && export SECCOMP_PATH="$(mktemp -d)" \ 108 && curl -fsSL "https://github.com/seccomp/libseccomp/releases/download/v${SECCOMP_VERSION}/libseccomp-${SECCOMP_VERSION}.tar.gz" \ 109 | tar -xzC "$SECCOMP_PATH" --strip-components=1 \ 110 && ( \ 111 cd "$SECCOMP_PATH" \ 112 && ./configure --prefix=/usr/local \ 113 && make \ 114 && make install \ 115 && ldconfig \ 116 ) \ 117 && rm -rf "$SECCOMP_PATH" 118 119 # Install Go 120 # IMPORTANT: If the version of Go is updated, the Windows to Linux CI machines 121 # will need updating, to avoid errors. Ping #docker-maintainers on IRC 122 # with a heads-up. 123 ENV GO_VERSION 1.6.2 124 RUN curl -fsSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" \ 125 | tar -xzC /usr/local 126 127 ENV PATH /go/bin:/usr/local/go/bin:$PATH 128 ENV GOPATH /go:/go/src/github.com/docker/docker/vendor 129 130 # Compile Go for cross compilation 131 ENV DOCKER_CROSSPLATFORMS \ 132 linux/386 linux/arm \ 133 darwin/amd64 \ 134 freebsd/amd64 freebsd/386 freebsd/arm \ 135 windows/amd64 windows/386 136 137 # This has been commented out and kept as reference because we don't support compiling with older Go anymore. 138 # ENV GOFMT_VERSION 1.3.3 139 # RUN curl -sSL https://storage.googleapis.com/golang/go${GOFMT_VERSION}.$(go env GOOS)-$(go env GOARCH).tar.gz | tar -C /go/bin -xz --strip-components=2 go/bin/gofmt 140 141 ENV GO_TOOLS_COMMIT 823804e1ae08dbb14eb807afc7db9993bc9e3cc3 142 # Grab Go's cover tool for dead-simple code coverage testing 143 # Grab Go's vet tool for examining go code to find suspicious constructs 144 # and help prevent errors that the compiler might not catch 145 RUN git clone https://github.com/golang/tools.git /go/src/golang.org/x/tools \ 146 && (cd /go/src/golang.org/x/tools && git checkout -q $GO_TOOLS_COMMIT) \ 147 && go install -v golang.org/x/tools/cmd/cover \ 148 && go install -v golang.org/x/tools/cmd/vet 149 # Grab Go's lint tool 150 ENV GO_LINT_COMMIT 32a87160691b3c96046c0c678fe57c5bef761456 151 RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint \ 152 && (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \ 153 && go install -v github.com/golang/lint/golint 154 155 # Install two versions of the registry. The first is an older version that 156 # only supports schema1 manifests. The second is a newer version that supports 157 # both. This allows integration-cli tests to cover push/pull with both schema1 158 # and schema2 manifests. 159 ENV REGISTRY_COMMIT_SCHEMA1 ec87e9b6971d831f0eff752ddb54fb64693e51cd 160 ENV REGISTRY_COMMIT 47a064d4195a9b56133891bbb13620c3ac83a827 161 RUN set -x \ 162 && export GOPATH="$(mktemp -d)" \ 163 && git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \ 164 && (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \ 165 && GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \ 166 go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \ 167 && (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT_SCHEMA1") \ 168 && GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \ 169 go build -o /usr/local/bin/registry-v2-schema1 github.com/docker/distribution/cmd/registry \ 170 && rm -rf "$GOPATH" 171 172 # Install notary and notary-server 173 ENV NOTARY_VERSION v0.3.0 174 RUN set -x \ 175 && export GOPATH="$(mktemp -d)" \ 176 && git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \ 177 && (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_VERSION") \ 178 && GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \ 179 go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \ 180 && GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \ 181 go build -o /usr/local/bin/notary github.com/docker/notary/cmd/notary \ 182 && rm -rf "$GOPATH" 183 184 # Get the "docker-py" source so we can run their integration tests 185 ENV DOCKER_PY_COMMIT 7befe694bd21e3c54bb1d7825270ea4bd6864c13 186 RUN git clone https://github.com/docker/docker-py.git /docker-py \ 187 && cd /docker-py \ 188 && git checkout -q $DOCKER_PY_COMMIT \ 189 && pip install -r test-requirements.txt 190 191 # Set user.email so crosbymichael's in-container merge commits go smoothly 192 RUN git config --global user.email 'docker-dummy@example.com' 193 194 # Add an unprivileged user to be used for tests which need it 195 RUN groupadd -r docker 196 RUN useradd --create-home --gid docker unprivilegeduser 197 198 VOLUME /var/lib/docker 199 WORKDIR /go/src/github.com/docker/docker 200 ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux 201 202 # Let us use a .bashrc file 203 RUN ln -sfv $PWD/.bashrc ~/.bashrc 204 205 # Register Docker's bash completion. 206 RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker 207 208 # Get useful and necessary Hub images so we can "docker load" locally instead of pulling 209 COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/ 210 RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \ 211 buildpack-deps:jessie@sha256:25785f89240fbcdd8a74bdaf30dd5599a9523882c6dfc567f2e9ef7cf6f79db6 \ 212 busybox:latest@sha256:e4f93f6ed15a0cdd342f5aae387886fba0ab98af0a102da6276eaf24d6e6ade0 \ 213 debian:jessie@sha256:f968f10b4b523737e253a97eac59b0d1420b5c19b69928d35801a6373ffe330e \ 214 hello-world:latest@sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7 215 # see also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is) 216 217 # Download man page generator 218 RUN set -x \ 219 && export GOPATH="$(mktemp -d)" \ 220 && git clone --depth 1 -b v1.0.4 https://github.com/cpuguy83/go-md2man.git "$GOPATH/src/github.com/cpuguy83/go-md2man" \ 221 && git clone --depth 1 -b v1.4 https://github.com/russross/blackfriday.git "$GOPATH/src/github.com/russross/blackfriday" \ 222 && go get -v -d github.com/cpuguy83/go-md2man \ 223 && go build -v -o /usr/local/bin/go-md2man github.com/cpuguy83/go-md2man \ 224 && rm -rf "$GOPATH" 225 226 # Download toml validator 227 ENV TOMLV_COMMIT 9baf8a8a9f2ed20a8e54160840c492f937eeaf9a 228 RUN set -x \ 229 && export GOPATH="$(mktemp -d)" \ 230 && git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml" \ 231 && (cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT") \ 232 && go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv \ 233 && rm -rf "$GOPATH" 234 235 # Install runc 236 ENV RUNC_COMMIT cc29e3dded8e27ba8f65738f40d251c885030a28 237 RUN set -x \ 238 && export GOPATH="$(mktemp -d)" \ 239 && git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ 240 && cd "$GOPATH/src/github.com/opencontainers/runc" \ 241 && git checkout -q "$RUNC_COMMIT" \ 242 && make static BUILDTAGS="seccomp apparmor selinux" \ 243 && cp runc /usr/local/bin/docker-runc \ 244 && rm -rf "$GOPATH" 245 246 # Install containerd 247 ENV CONTAINERD_COMMIT 860f3a94940894ac0a106eff4bd1616a67407ee2 248 RUN set -x \ 249 && export GOPATH="$(mktemp -d)" \ 250 && git clone https://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" \ 251 && cd "$GOPATH/src/github.com/docker/containerd" \ 252 && git checkout -q "$CONTAINERD_COMMIT" \ 253 && make static \ 254 && cp bin/containerd /usr/local/bin/docker-containerd \ 255 && cp bin/containerd-shim /usr/local/bin/docker-containerd-shim \ 256 && cp bin/ctr /usr/local/bin/docker-containerd-ctr \ 257 && rm -rf "$GOPATH" 258 259 # Wrap all commands in the "docker-in-docker" script to allow nested containers 260 ENTRYPOINT ["hack/dind"] 261 262 # Upload docker source 263 COPY . /go/src/github.com/docker/docker