Move mount back to its own package, not inside docker

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack 2017-04-09 12:53:46 +01:00
parent 48cb54d378
commit 3ffa912c41
5 changed files with 48 additions and 13 deletions

View File

@ -38,7 +38,5 @@ RUN set -x \
&& rm docker.tgz \
&& docker -v
COPY . ./
# use the Docker copy of tini as our init for zombie reaping
ENTRYPOINT ["/usr/bin/docker-init", "/bin/sh", "/docker.sh"]
ENTRYPOINT ["/usr/bin/docker-init", "/usr/bin/dockerd"]

View File

@ -5,7 +5,7 @@ IMAGE=docker-ce
default: push
hash: Dockerfile docker.sh
hash: Dockerfile
DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
docker run --entrypoint /bin/sh --rm $(IMAGE):build -c 'cat $^ /lib/apk/db/installed | sha1sum' | sed 's/ .*//' > $@

11
pkg/mount/Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM alpine:3.5
RUN \
apk update && apk upgrade -a && \
apk add --no-cache \
jq \
sfdisk \
&& true
COPY . ./
CMD ["/bin/sh", "/mount.sh"]

29
pkg/mount/Makefile Normal file
View File

@ -0,0 +1,29 @@
.PHONY: tag push
BASE=alpine:3.5
IMAGE=mount
default: push
hash: Dockerfile mount.sh
DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
docker run --rm --entrypoint /bin/sh $(IMAGE):build -c "cat $^ /lib/apk/db/installed | sha1sum" | sed 's/ .*//' > $@
push: hash
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
(docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash) && \
docker push mobylinux/$(IMAGE):$(shell cat hash))
docker rmi $(IMAGE):build
rm -f hash
tag: hash
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash)
docker rmi $(IMAGE):build
rm -f hash
clean:
rm -f hash
.DELETE_ON_ERROR:

View File

@ -2,12 +2,14 @@
set -x
MOUNTPOINT="$1"
[ -z "$MOUNTPOINT" ] && echo "No mountpoint specified" && exit 1
mkdir -p "$MOUNTPOINT"
mount_drive()
{
MOUNTPOINT=/var/lib/docker
mkdir -p "$MOUNTPOINT"
# TODO fix for multiple disks, cdroms etc
DEVS="$(find /dev -maxdepth 1 -type b ! -name 'loop*' ! -name 'nbd*' | grep -v '[0-9]$' | sed 's@.*/dev/@@' | sort)"
@ -28,11 +30,6 @@ mount_drive()
done
echo "WARNING: Failed to mount a persistent volume (is there one?)"
# not sure if we want to fatally bail here, in some debug situations it is ok
# exit 1
}
mount_drive
exec /usr/bin/dockerd