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