Sign inSign up

tidyrailroad/run-injector

By tidyrailroad

•Updated over 9 years ago

Injects dependencies into volumes

Image
0

610

tidyrailroad/run-injector repository overview

⁠Run Injector

⁠Synopsis

Injects a dependency into a container via its volumes.

⁠Getting Started

You need docker⁠. You shoud not need anything else.

⁠Example

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

⁠Options

Most of the options are from docker run⁠.

The special options are:

  1. sudo - This identifies the volume where a sudo file will be written.
  2. bin - This indicates the volume where the user script will be written.
  3. sbin - This indicates the volume where the root script will be written.
  4. image - This indicates the docker image to be run
  5. command - This indicates the command (overriding the command from the Dockerfile).

⁠Motivation

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.

Tag summary

Content type

Image

Digest

Size

34.5 MB

Last updated

over 9 years ago

docker pull tidyrailroad/run-injector:0.0.3