Build a docker image and push it to a registry.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.0KB

Deploy docker as a service

Download a git repository which has a Dockerfile, build it locally, push it to a registry and create a systemd service to manage it.

Requirements

None.

Role Variables

  • git_repository: The repository in which the dockerfile is located.
  • git_repository_destination: Local path in which to clone the git repository.
  • git_repository_tag: Version to use of the git repository.
  • service_name: Name of the systemd service.
  • docker_registry: Domain of the registry with write access.
  • docker_registry_read: Domain of the registry with read access.
  • registry_user: User used to authenticate with the registry.
  • registry_password: Password used to authenticate with the registry.
  • docker_tag: Docker tag.
  • docker_command: Docker command used to launch the container.

Dependencies

None.

Example Playbook

- hosts: servers
  vars:
    git_repository: https://git.digitales.cslabrecha.org/La_Brecha_Digital/prosody-docker
    git_repository_destination: /home/drymer/Proyectos/LaBrechaDigital/prosody-docker
    git_repository_tag: v0.1.1
    service_name: prosody
    docker_registry: r.daemons.it
    docker_registry_read: registry.daemons.it
    registry_user: drymer
    registry_password: whatever
    docker_tag: "{{ git_repository_tag }}"
    docker_command: /usr/bin/docker run --rm -i -v /root/docker/prosody/conf:/etc/prosody/ -v /root/docker/prosody/ssl:/etc/prosody/certs/ -v /root/docker/prosody/modules:/usr/lib/prosody/modules/extra:ro -v /root/docker/prosody/logs:/var/log/prosody/ -v /root/docker/prosody/images/:/var/lib/prosody/ -e LOCAL=admin -e DOMAIN=daemons.it -e PASSWORD=qv9NEdTBYxBv78rIfNOBVZIeICuRc -p 5222:5222 -p 5269:5269 -p 5280:5280 -p 5281:5281 --name "{{ service_name }}" "{{ docker_registry_read }}/{{ service_name }}"
  roles:
    - { role: deploy-docker}

Compatible

With:

  • Debian 9

License

GPL3

Author Information

drymer [ EN ] autistici.org