Created
September 22, 2018 19:51
-
-
Save ihucos/6a0b50db19fe3b4796adee9172f5dab7 to your computer and use it in GitHub Desktop.
Run the docker daemon inside plash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env plash-exec | |
--# usage: plash docker-daemon <DOCKER-ARGS> | |
--# Run the docker daemon inside alpine linux. Use the PLASH_DOCKER_SOCKET | |
--# environment variable to select the docker socket, the default is | |
--# '/tmp/docker.sock'. Note that '/var/run/docker.sock' is not shared between | |
--# containers and host, so it may not be appropriate as a socket | |
--# | |
--# | |
--# Example: | |
--# | |
--# $ sudo plash docker-daemon | |
--# INFO[2018-02-05T00:20:06.645188781Z] libcontainerd: new containerd process, pid: 19841 | |
--# <snip> | |
--# INFO[2018-02-05T00:20:07.840933519Z] Daemon has completed initialization | |
--# INFO[2018-02-05T00:20:07.849471459Z] API listen on /tmp/docker.sock | |
--from | |
alpine | |
--apk | |
docker | |
--layer | |
--entrypoint-script | |
#!/bin/sh | |
# we need to "encapsulate" the socket. Docker creates it accesible by the docker | |
# group, but the gid inside the guest could be anything for the host (closes #8) | |
mkdir -p /tmp/plash-docker-wrap/ | |
chown root:root /tmp/plash-docker-wrap/ | |
chmod 600 /tmp/plash-docker-wrap/ | |
export DOCKER_RAMDISK=1 | |
exec dockerd -H unix://${PLASH_DOCKER_SOCKET:-/tmp/plash-docker-wrap/docker.sock} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment