ARG VERSION=docker:17.06.0-ce-dind FROM ${VERSION} RUN apk add --no-cache git tmux py2-pip apache2-utils vim build-base gettext-dev curl bash-completion bash util-linux jq openssh qemu-img qemu-system-x86_64 ENV GOPATH /root/go ENV PATH $PATH:$GOPATH # Use specific moby commit due to vendoring mismatch ENV MOBY_COMMIT="a73c3d3667f32fd61febcd2e824aa0341a57bafd" RUN mkdir /root/go && apk add --no-cache go \ && go get -u -d github.com/moby/tool/cmd/moby && (cd $GOPATH/src/github.com/moby/tool/cmd/moby && git checkout $MOBY_COMMIT && go install) \ && go get -u github.com/linuxkit/linuxkit/src/cmd/linuxkit \ && rm -rf /root/go/pkg && rm -rf /root/go/src && rm -rf /usr/lib/go # Compile and install httping # (used in orchestration workshop, and very useful anyway) RUN mkdir -p /opt && cd /opt && \ curl https://www.vanheusden.com/httping/httping-2.5.tgz | \ tar -zxf- && cd httping-2.5 && \ ./configure && make install LDFLAGS=-lintl && \ rm -rf httping-2.5 ENV COMPOSE_VERSION=1.13.0 ENV MACHINE_VERSION=v0.11.0 # Install Compose and Machine RUN pip install docker-compose==${COMPOSE_VERSION} RUN curl -L https://github.com/docker/machine/releases/download/${MACHINE_VERSION}/docker-machine-Linux-x86_64 \ -o /usr/bin/docker-machine && chmod +x /usr/bin/docker-machine # Add bash completion and set bash as default shell RUN mkdir /etc/bash_completion.d \ && curl https://raw.githubusercontent.com/docker/cli/master/contrib/completion/bash/docker -o /etc/bash_completion.d/docker \ && sed -i "s/ash/bash/" /etc/passwd # Replace modprobe with a no-op to get rid of spurious warnings # (note: we can't just symlink to /bin/true because it might be busybox) RUN rm /sbin/modprobe && echo '#!/bin/true' >/sbin/modprobe && chmod +x /sbin/modprobe # Install a nice vimrc file and prompt (by soulshake) COPY ["docker-prompt","/usr/local/bin/"] COPY [".vimrc",".profile", ".inputrc", ".gitconfig", "./root/"] COPY ["motd", "/etc/motd"] COPY ["daemon.json", "/etc/docker/"] ARG docker_storage_driver=overlay2 ENV DOCKER_STORAGE_DRIVER=$docker_storage_driver # Move to our home WORKDIR /root # Setup certs and ssh keys RUN mkdir -p /var/run/pwd/certs && mkdir -p /var/run/pwd/uploads \ && ssh-keygen -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key >/dev/null \ && mkdir ~/.ssh && ssh-keygen -N "" -t rsa -f ~/.ssh/id_rsa \ && cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys # Remove IPv6 alias for localhost and start docker in the background ... CMD cat /etc/hosts >/etc/hosts.bak && \ sed 's/^::1.*//' /etc/hosts.bak > /etc/hosts && \ sed -i "s/\DOCKER_STORAGE_DRIVER/$DOCKER_STORAGE_DRIVER/" /etc/docker/daemon.json && \ sed -i "s/\PWD_IP_ADDRESS/$PWD_IP_ADDRESS/" /etc/docker/daemon.json && \ sed -i "s/\DOCKER_TLSENABLE/$DOCKER_TLSENABLE/" /etc/docker/daemon.json && \ sed -i "s/\DOCKER_TLSCACERT/$DOCKER_TLSCACERT/" /etc/docker/daemon.json && \ sed -i "s/\DOCKER_TLSCERT/$DOCKER_TLSCERT/" /etc/docker/daemon.json && \ sed -i "s/\DOCKER_TLSKEY/$DOCKER_TLSKEY/" /etc/docker/daemon.json && \ umount /var/lib/docker && mount -t securityfs none /sys/kernel/security && \ echo "root:root" | chpasswd &> /dev/null && \ /usr/sbin/sshd -o PermitRootLogin=yes -o PrintMotd=no 2>/dev/null && \ dockerd &>/docker.log & \ while true ; do script -q -c "/bin/bash -l" /dev/null ; done # ... and then put a shell in the foreground, restarting it if it exits