auphofBSF / docker-formula

Install and set up Docker

Home Page:http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker-formula

Extensible formula to manage Docker on MacOS, Windows, and GNU/Linux. Currently supports:

The default docker.software and docker.compose.software states support:

The other states support container managmement.

Travis CI Build Status Semantic Release

A SaltStack formula for Docker on MacOS, GNU/Linux and Windows.

Table of Contents

General notes

See the full SaltStack Formulas installation and usage instructions. If you are interested in writing or contributing to formulas, please pay attention to the Writing Formula Section. If you want to use this formula, please pay attention to the FORMULA file and/or git tag, which contains the currently released version. This formula is versioned according to Semantic Versioning. See Formula Versioning Section for more details.

Contributing to this repo

Commit message formatting is significant!!

Please see How to contribute <CONTRIBUTING> for more details.

Available Meta states

docker

Meta-state (This is a state that includes other states).

This state installs the Docker solution (see https://docs.docker.io)

docker.clean

Meta-state (This is a state that includes other states).

Stop Docker daemon and remove docker packages ('docker', 'docker-engine', 'docker-ce', etc) on Linux. To protect OS integrity, this state won't remove packages listed as dependencies (i.e. python is kept).

docker.software.package.repo

Configures the upstream Docker's repo on RedHat/Debian OS.

docker.software.package.repo.clean

This state removes upstream Docker package repository only, on RedHat/Debian OS.

docker.software

This state installs Docker (see https://docs.docker.com/engine/install and https://docs.docker.com/desktop/)

docker.software.service

This state installs Dockerd daemon on Linux (systemd support).

docker.software.service

This state stops Dockerd daemon on Linux (systemd support).

docker.software.config

This state overrides default Docker options (i.e. /etc/default/docker):

docker:
  pkg:
    docker:
      config:
        - DOCKER_OPTS="-s btrfs --dns 8.8.8.8"
        - export http_proxy="http://172.17.42.1:3128"

docker.software.config.clean

This state uninstalls Docker overrides (i.e. /etc/default/docker).

docker.software.clean

This state uninstalls Docker software.

docker.containers

Pulls and runs a number of docker containers. See docker container API for docker.containers options:

docker:
  containers:
    running:
      - prometheus_simple
      - prometheus_detail

    prometheus_simple:
      image: "prom/prometheus:v1.7.1"

    prometheus_detail:
      image: "prom/prometheus:v1.7.1"
      # see https://docker-py.readthedocs.io/en/stable/containers.html

docker.compose

Saltstack dockercompose module state support (See https://docs.saltstack.com/en/2018.3/ref/modules/all/salt.modules.dockercompose.html).

docker.compose.ng

The intent is to provide an interface similar to the specification provided by docker-compose. The hope is that you may provide pillar data similar to that which you would use to define services with docker-compose. The assumption is that you are already using pillar data and salt formulae to represent the state of your existing infrastructure.

No real effort had been made to support every possible feature of docker-compose. Rather, we prefer the syntax provided by the docker-compose whenever it is reasonable for the sake of simplicity.

It is worth noting that we have added one attribute which is decidedly absent from the docker-compose specification. That attribute is dvc. This is a boolean attribute which allows us to define data only volume containers which can not be represented with the docker.software.service.running state since they are not intended to include a long living service inside the container.

See the included pillar.example for a representative pillar data block. To use this formula, you might target a host with the following pillar:

Then you would target a host with the following states:

docker.swarm

Saltstack swarm module state support (See https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.swarm.html).

docker.swarm.clean

Opposite of docker.swarm state (See https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.swarm.html).

docker.networks ^^^^^^^^^^^^^^^^^^

Create docker networks

docker.networks.clean

Remove docker networks

Sub-states

Sub-states are available inside sub-directories.

Testing

Linux testing is done with kitchen-salt.

Requirements

  • Ruby
  • Docker

Where [platform] is the platform name defined in kitchen.yml, e.g. debian-9-2019-2-py3.

bin/kitchen converge ^^^^^^^^^^^^^^^^^^^^

Creates the Docker instance and runs the docker main state, ready for testing.

bin/kitchen verify ^^^^^^^^^^^^^^^^^^

Runs the inspec tests on the actual instance.

bin/kitchen destroy ^^^^^^^^^^^^^^^^^^^

Removes the Docker instance.

bin/kitchen test ^^^^^^^^^^^^^^^^

Runs all of the stages above in one go: i.e. destroy + converge + verify + destroy.

bin/kitchen login ^^^^^^^^^^^^^^^^^

Gives you SSH access to the instance for manual testing.

About

Install and set up Docker

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html

License:Other


Languages

Language:SaltStack 67.6%Language:Ruby 12.6%Language:Jinja 11.9%Language:JavaScript 5.4%Language:Shell 1.6%Language:Python 0.6%Language:Dockerfile 0.3%