Formulas to manage a collection of docker images and containers. Includes build and runtime update and dependency management and robustness features as lost link rebuild, images testing and undo update.
- builds docker images (from git)
- docker build dependency management
- docker container runtime configuration
- manages updates
- manages deconstruction of old containers
- container dependency management: restart dependant containers
- container link management: rebuild lost links
- container originating IP address management (via )
- docker container lifecycle management
The configuration shown below (Salt fileserver and pillar data from git) works as well with the master as with a stand alone client.
Add the minion keys to the Salt Minion Container
You'll nedd to add the git private key to the container.
In this case just add the git repo to the minion config, no keys are needed.
We've found it useful to store everything in git, so our master.yaml
contains something like this:
fileserver_backend:
- git
gitfs_remotes:
- file:///repos/salt-states.git
- file:///repos/docker.git:
- mountpoint: salt://docker
file_ignore_regex:
- '/\.git($|/)'
ext_pillar:
- git: master file:///repos/salt-pillar.git
pillar_roots:
base:
- /
It's about managing docker from within a docker container and it works like this:
- build the docker image
- on a new host, preferrably CoreOS,
----------
ID: something-image
Function: docker.built
Name: hinnerk/something:testing
Result: True
Comment: Successfully built XXX
Started: 23:15:16.801226
Duration: 31560.154 ms
Changes:
----------
ID: something-tag-previous
Function: cmd.run
Name: docker tag -f hinnerk/something:latest hinnerk/something:previous
Result: True
Comment: State was not run because onchanges req did not change
Started:
Duration:
Changes:
----------
ID: something-tag-current
Function: cmd.run
Name: docker tag -f hinnerk/something:testing hinnerk/something:latest
Result: True
Comment: State was not run because onchanges req did not change
Started:
Duration:
Changes:
Push successfully tested images to a registry.
When a linked container is reolaced, the link goes missing. We're detecting thoise missing links by comparing the links declared in the pillar with the output of docker inspect <container>
. Containers with links missing are removed.
Currently this happens after the initial call of docker.running
of all containers. So we need to trigger an additional call to docker.running
here.