Dockerfile 7.3 KB

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