github.com/dpiddy/docker@v1.12.2-rc1/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.3 124 125 # Compile Go for cross compilation 126 ENV DOCKER_CROSSPLATFORMS \ 127 linux/386 linux/arm \ 128 darwin/amd64 \ 129 freebsd/amd64 freebsd/386 freebsd/arm \ 130 windows/amd64 windows/386 131 132 RUN curl -fsSL "https://storage.googleapis.com/golang/go1.4.3.linux-amd64.tar.gz" \ 133 | tar -xzC /root && \ 134 mv /root/go /root/go1.4 && \ 135 cd /usr/local && \ 136 curl -fsSL "https://storage.googleapis.com/golang/go$GO_VERSION.src.tar.gz" \ 137 | tar -xzC /usr/local && \ 138 cd go && \ 139 printf 'diff --git a/src/runtime/sys_darwin_amd64.s b/src/runtime/sys_darwin_amd64.s\nindex e09b906..fa8ff2f 100644\n--- a/src/runtime/sys_darwin_amd64.s\n+++ b/src/runtime/sys_darwin_amd64.s\n@@ -157,6 +157,7 @@ systime:\n\t// Fall back to system call (usually first call in this thread).\n\tMOVQ\tSP, DI\n\tMOVQ\t$0, SI\n+\tMOVQ\t$0, DX // required as of Sierra; Issue 16570\n\tMOVL\t$(0x2000000+116), AX\n\tSYSCALL\n\tCMPQ\tAX, $0\n' | patch -p1 && \ 140 cd src && \ 141 ./make.bash 142 143 ENV PATH /go/bin:/usr/local/go/bin:$PATH 144 ENV GOPATH /go:/go/src/github.com/docker/docker/vendor 145 146 # This has been commented out and kept as reference because we don't support compiling with older Go anymore. 147 # ENV GOFMT_VERSION 1.3.3 148 # 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 149 150 ENV GO_TOOLS_COMMIT 823804e1ae08dbb14eb807afc7db9993bc9e3cc3 151 # Grab Go's cover tool for dead-simple code coverage testing 152 # Grab Go's vet tool for examining go code to find suspicious constructs 153 # and help prevent errors that the compiler might not catch 154 RUN git clone https://github.com/golang/tools.git /go/src/golang.org/x/tools \ 155 && (cd /go/src/golang.org/x/tools && git checkout -q $GO_TOOLS_COMMIT) \ 156 && go install -v golang.org/x/tools/cmd/cover \ 157 && go install -v golang.org/x/tools/cmd/vet 158 # Grab Go's lint tool 159 ENV GO_LINT_COMMIT 32a87160691b3c96046c0c678fe57c5bef761456 160 RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint \ 161 && (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \ 162 && go install -v github.com/golang/lint/golint 163 164 # Install two versions of the registry. The first is an older version that 165 # only supports schema1 manifests. The second is a newer version that supports 166 # both. This allows integration-cli tests to cover push/pull with both schema1 167 # and schema2 manifests. 168 ENV REGISTRY_COMMIT_SCHEMA1 ec87e9b6971d831f0eff752ddb54fb64693e51cd 169 ENV REGISTRY_COMMIT 47a064d4195a9b56133891bbb13620c3ac83a827 170 RUN set -x \ 171 && export GOPATH="$(mktemp -d)" \ 172 && git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \ 173 && (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \ 174 && GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \ 175 go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \ 176 && (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT_SCHEMA1") \ 177 && GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \ 178 go build -o /usr/local/bin/registry-v2-schema1 github.com/docker/distribution/cmd/registry \ 179 && rm -rf "$GOPATH" 180 181 # Install notary and notary-server 182 ENV NOTARY_VERSION v0.3.0 183 RUN set -x \ 184 && export GOPATH="$(mktemp -d)" \ 185 && git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \ 186 && (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_VERSION") \ 187 && GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \ 188 go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \ 189 && GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \ 190 go build -o /usr/local/bin/notary github.com/docker/notary/cmd/notary \ 191 && rm -rf "$GOPATH" 192 193 # Get the "docker-py" source so we can run their integration tests 194 ENV DOCKER_PY_COMMIT 7befe694bd21e3c54bb1d7825270ea4bd6864c13 195 RUN git clone https://github.com/docker/docker-py.git /docker-py \ 196 && cd /docker-py \ 197 && git checkout -q $DOCKER_PY_COMMIT \ 198 && pip install -r test-requirements.txt 199 200 # Set user.email so crosbymichael's in-container merge commits go smoothly 201 RUN git config --global user.email 'docker-dummy@example.com' 202 203 # Add an unprivileged user to be used for tests which need it 204 RUN groupadd -r docker 205 RUN useradd --create-home --gid docker unprivilegeduser 206 207 VOLUME /var/lib/docker 208 WORKDIR /go/src/github.com/docker/docker 209 ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux 210 211 # Let us use a .bashrc file 212 RUN ln -sfv $PWD/.bashrc ~/.bashrc 213 214 # Register Docker's bash completion. 215 RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker 216 217 # Get useful and necessary Hub images so we can "docker load" locally instead of pulling 218 COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/ 219 RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \ 220 buildpack-deps:jessie@sha256:25785f89240fbcdd8a74bdaf30dd5599a9523882c6dfc567f2e9ef7cf6f79db6 \ 221 busybox:latest@sha256:e4f93f6ed15a0cdd342f5aae387886fba0ab98af0a102da6276eaf24d6e6ade0 \ 222 debian:jessie@sha256:f968f10b4b523737e253a97eac59b0d1420b5c19b69928d35801a6373ffe330e \ 223 hello-world:latest@sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7 224 # see also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is) 225 226 # Download man page generator 227 RUN set -x \ 228 && export GOPATH="$(mktemp -d)" \ 229 && git clone --depth 1 -b v1.0.5 https://github.com/cpuguy83/go-md2man.git "$GOPATH/src/github.com/cpuguy83/go-md2man" \ 230 && git clone --depth 1 -b v1.4 https://github.com/russross/blackfriday.git "$GOPATH/src/github.com/russross/blackfriday" \ 231 && go get -v -d github.com/cpuguy83/go-md2man \ 232 && go build -v -o /usr/local/bin/go-md2man github.com/cpuguy83/go-md2man \ 233 && rm -rf "$GOPATH" 234 235 # Download toml validator 236 ENV TOMLV_COMMIT 9baf8a8a9f2ed20a8e54160840c492f937eeaf9a 237 RUN set -x \ 238 && export GOPATH="$(mktemp -d)" \ 239 && git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml" \ 240 && (cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT") \ 241 && go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv \ 242 && rm -rf "$GOPATH" 243 244 # Install runc 245 ENV RUNC_COMMIT cc29e3dded8e27ba8f65738f40d251c885030a28 246 RUN set -x \ 247 && export GOPATH="$(mktemp -d)" \ 248 && git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ 249 && cd "$GOPATH/src/github.com/opencontainers/runc" \ 250 && git checkout -q "$RUNC_COMMIT" \ 251 && make static BUILDTAGS="seccomp apparmor selinux" \ 252 && cp runc /usr/local/bin/docker-runc \ 253 && rm -rf "$GOPATH" 254 255 # Install containerd 256 ENV CONTAINERD_COMMIT v0.2.4 257 RUN set -x \ 258 && export GOPATH="$(mktemp -d)" \ 259 && git clone https://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" \ 260 && cd "$GOPATH/src/github.com/docker/containerd" \ 261 && git checkout -q "$CONTAINERD_COMMIT" \ 262 && make static \ 263 && cp bin/containerd /usr/local/bin/docker-containerd \ 264 && cp bin/containerd-shim /usr/local/bin/docker-containerd-shim \ 265 && cp bin/ctr /usr/local/bin/docker-containerd-ctr \ 266 && rm -rf "$GOPATH" 267 268 # Wrap all commands in the "docker-in-docker" script to allow nested containers 269 ENTRYPOINT ["hack/dind"] 270 271 # Upload docker source 272 COPY . /go/src/github.com/docker/docker