Fixes scary output on docker startup.

This commit is contained in:
Travis Reeder
2017-06-15 15:48:34 -07:00
committed by Reed Allman
parent 855dcf6ac7
commit 9a8ff408b5
14 changed files with 50 additions and 75 deletions

View File

@@ -1,11 +1,13 @@
FROM docker:1.13.1-dind
FROM docker:edge-dind
RUN apk update && apk upgrade && apk add --no-cache ca-certificates
RUN apk add --no-cache ca-certificates
COPY entrypoint.sh /usr/local/bin/
COPY dind.sh /usr/local/bin/
# cleanup warning: https://github.com/docker-library/docker/issues/55
RUN addgroup -g 2999 docker
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
COPY preentry.sh /usr/local/bin/
# USAGE: Add a CMD to your own Dockerfile to use this (NOT an ENTRYPOINT, so that this is called)
ENTRYPOINT ["preentry.sh"]
# USAGE: Add a CMD to your own Dockerfile to use this (NOT an ENTRYPOINT), eg:
# CMD ["./runner"]

View File

@@ -1,2 +1,4 @@
This is the base image for all Titan's docker-in-docker images.
This is the base image for all docker-in-docker images.
The difference between this and the official `docker` images are that this will choose the best
filesystem automatically. The official ones use `vfs` (bad) by default unless you pass in a flag.

View File

@@ -1 +1 @@
0.1.2
0.1.3

View File

@@ -1,3 +1,3 @@
set -ex
docker build -t treeder/dind:latest .
docker build --build-arg HTTP_PROXY -t funcy/dind:latest .

View File

@@ -1,28 +0,0 @@
#!/bin/sh
set -ex
# modified from: https://github.com/docker-library/docker/blob/866c3fbd87e8eeed524fdf19ba2d63288ad49cd2/1.11/dind/dockerd-entrypoint.sh
# this will run either overlay or aufs as the docker fs driver, if the OS has both, overlay is preferred.
# rewrite overlay to use overlay2 (docker 1.12, linux >=4.x required), see https://docs.docker.com/engine/userguide/storagedriver/selectadriver/#overlay-vs-overlay2
fsdriver=$(grep -Eh -w -m1 "overlay|aufs" /proc/filesystems | cut -f2)
if [ $fsdriver == "overlay" ]; then
fsdriver="overlay2"
fi
cmd="dockerd \
--host=unix:///var/run/docker.sock \
--host=tcp://0.0.0.0:2375 \
--storage-driver=$fsdriver"
# nanny and restart on crashes
until eval $cmd; do
echo "Docker crashed with exit code $?. Respawning.." >&2
# if we just restart it won't work, so start it (it wedges up) and
# then kill the wedgie and restart it again and ta da... yea, seriously
pidfile=/var/run/docker/libcontainerd/docker-containerd.pid
kill -9 $(cat $pidfile)
rm $pidfile
sleep 1
done

View File

@@ -1,10 +0,0 @@
#!/bin/sh
set -ex
/usr/local/bin/dind.sh &
# wait for daemon to initialize
sleep 3
exec "$@"

14
images/dind/preentry.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/sh
set -e
fsdriver=$(grep -Eh -w -m1 "overlay|aufs" /proc/filesystems | cut -f2)
if [ $fsdriver == "overlay" ]; then
fsdriver="overlay2"
fi
dockerd-entrypoint.sh --storage-driver=$fsdriver &
# give docker a few seconds
sleep 3
exec "$@"

View File

@@ -6,7 +6,7 @@ docker run --rm -v "$PWD":/app treeder/bump patch
version=`cat VERSION`
echo "version $version"
docker tag treeder/dind:latest treeder/dind:$version
docker tag funcy/dind:latest funcy/dind:$version
docker push treeder/dind:latest
docker push treeder/dind:$version
docker push funcy/dind:latest
docker push funcy/dind:$version