Base ubuntu image that establises a base set of patterns and tools for building other containers
- ship.d pattern:
shipentrypoint to execute ship.d scripts
See the usage section below
- envconsul built-in: for creating environment variables based on consul k/v pairs
- ark-host/ark-hostname route: /etc/host route to the docker host (configurable, but defaults to the default route IP)
Inside a docker container, the host’s ip and name are not available. By invoking these scripts, we can make the container aware of its host as necessary. They create the environment variables ARK_HOST and ARK_HOSTNAME.
A tool for generating config files from jinja templates and environment variables.
This script lets a service owner build configuration files that are created at run time from environment variables and a template file. The template language is jinja and any template variables must be available as e nvironment variables. env_parse takes one argument, the template, and an optional argument for the output file. If omitted, the output file is identical to the template file name with the trailing .j2 removed.
Any container built on top of the socrata/base image will default to running the whatever script is dropped in
/etc/ship.d/run. Alternatively, you can invoke any script dropped in /etc/ship.d/ or any executable in the container via the CMD argument:
$ docker pull socrata/base $ docker run --rm -t -i socrata/base [CMD] # Examples: $ docker run --rm -t -i socrata/base # runs /etc/ship.d/run in the container $ docker run --rm -t -i socrata/base bash # launch a bash shell (on PATH) # From inside the container, launch the /etc/shipd.d/run docker-host$ ship [run]
Assuming we build an image called awesome_sauce from a Dockerfile like this:
FROM socrata/base ADD run /etc/ship.d/ ADD migrate /etc/ship.d/
run script starts a service and
migrate is a one-off script for performing migrations.
$ docker run --rm -t -i awesome_sauce migrate # runs the migrations from the container $ docker run --rm -t -i awesome_sauce # starts the awesome_sauce service (via the `run` script)