luzifer / dockermanager
The intention of this project is to have a running daemon on a docker host server which is able to realize a configuration of docker containers. For this it manages all containers and images on the docker host. This includes starting and stopping containers which are or are not defined by the configuration file.
Missing / Planned Features
- Support load balancing / distribution of containers to create spread load on all servers
- For this feature the serf master-election was built in. Currently it is not used.
- One or more host servers with latest lxc-docker
- A serf-agent running on each host and connected to one gossip-network
- A config file or config URL to serve the configuration from
- Docker daemon listening on tcp port
- The dockermanager set up
- If you want to use images from a private registry put a
docker login) to the homedir of the user running dockermanager
# ./dockermanager --help Usage of ./dockermanager: -c, --config="config.yaml": Config file or URL to read the config from --configInterval=10: Sleep time in minutes to wait between config reloads --docker-certs="": Directory containing cert.pem, key.pem, ca.pem for the registry --docker-host="tcp://192.168.59.103:2376": Connection method to the docker server --fullHost[=true]: Manage all containers on host --refreshInterval=30: fetch new images every <N> minutes --serfAddress="127.0.0.1:7373": Address of the serf agent to connect to --standalone[=false]: Do not use Serf to talk to other hosts
The configuration is written in YAML format and reloaded regulary by the daemon:
container-name: Name of the container on the host. Needs to be unique
command: Override CMD value set by Dockerfile
hosts: Array of hostnames (serf node names) to deploy the container to or
image: Name of the image
tag: Tag for the image, probably
links: Links to other containers in format
volumes: Volume mapping in form
ports: Array of port configurations
container: Exported port in the container e.g.
local: IP/port combination in the form
environment: Array of enviroment variables in form
update_times: Array of allowed time frames for updates of this container in format
HH:MM-HH:MM(Optional, if not specified container is allowed to get updated all the time.)
start_times: Cron-style time specification when to start this container. Pay attention to choose a container quitting before your specified interval for this. Containers having this specification will not get started by default and are not restarted after they quit. Use this for starting cron-like tasks.
stop_timeout: Time in seconds to wait when stopping a deprecated container to be exchanged. (default: 5s)
labels: Labels to attach to the container (for example the config for the DockerProxy)
dockerproxy: Configuration for the dockerproxy
slug: Name part of the URL to map to this container
port: Published port (see
add_cap: Array of capabilities to add to this container
Example configuration for a jenkins container:
--- jenkins: hosts: - docker01 image: luzifer/jenkins tag: latest links: - "othercontainername:alias" volumes: - "/home/ubuntu/data/jenkins_home:/var/jenkins_home" ports: - container: 8080/tcp local: 0.0.0.0:1000 environment: - MYVAR=value dockerproxy: slug: jenkins port: 1000 update_times: - 04:00-06:00 stop_timeout: 20 scheduletest: hosts: - docker01 image: jlekie/curl tag: latest command: - "http://example.com/page" start_times: "*/2 * * * *"
Current version is marked as 0.x.x and for this it is to be considered unstable. As soon as the load balancing is implemented I will move to the 1.x.x version and the app will be stable within the major version.