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