Injects dependencies into volumes
610
Injects a dependency into a container via its volumes.
You need docker. You shoud not need anything else.
Create some volumes
SUDO=$(docker volume create) &&
BIN=$(docker volume create) &&
SBIN=$(docker volume create)
Inject into the volumes.
docker \
run \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
emorymerryman/run-injector:0.0.0 \
--sudo ${SUDO} \
--bin ${BIN} \
--sbin ${SBIN} \
--program-name hello \
--image emorymerryman/base:0.1.1 \
--user user \
--command echo hello world
Containers with those volumes can use the injected dependencies.
docker \
run \
--interactive \
--tty \
--rm \
--volume ${SUDO}:/etc/sudoers.d:ro \
--volume ${BIN}:/usr/local/bin:ro \
--volume ${SBIN}:/usr/local/sbin:ro \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
--user user \
emorymerryman/base:0.1.1 \
hello
Most of the options are from docker run.
The special options are:
We should keep docker images small. We prefer minimal bases. We do not want to install software. We prefer to use docker to run things.
This is not an image that invokes 'docker run'. Instead it creates a script that invokes 'docker run'. It puts this script in the 'sbin' volume. It is anticipated that the target container will have docker installed.
It is anticipated that the target container will not be run as root and that the regular user will not be part of the docker group. For this reason, a user script will be put in the bin volume and a sudo file will be put in the sudo volume. The user script invokes the root script and the sudo file permits this.
Content type
Image
Digest
Size
34.5 MB
Last updated
over 9 years ago
docker pull tidyrailroad/run-injector:0.0.3