Исходя из ваших комментариев, я бы посоветовал вам использовать Ansible, если вам не нужна функциональность роя и требуется поддержка только одного хоста.Для Ansible требуется только доступ по SSH, который у вас, вероятно, уже имеется.
Очень легко использовать существующий сервис, определенный в Docker Compose, или вы можете просто вызывать свои сценарии оболочки в Ansible.Нет необходимости открывать демон Docker для внешнего мира.
Очень простой файл примера (playbook.yml
)
- hosts: all
tasks:
- name: setup container
docker_container:
name: helloworld
image: hello-world
Запуск playbook
ansible-playbook -i username@mysshhost.com, playbook.yml
Ansibleпредоставляет практически все функции, необходимые для взаимодействия с Docker через его модульную систему:
docker_service
Use your existing Docker compose files to orchestrate containers on a single Docker daemon or on Swarm. Supports compose versions 1 and 2.
docker_container
Manages the container lifecycle by providing the ability to create, update, stop, start and destroy a container.
docker_image
Provides full control over images, including: build, pull, push, tag and remove.
docker_image_facts
Inspects one or more images in the Docker host’s image cache, providing the information as facts for making decision or assertions in a playbook.
docker_login
Authenticates with Docker Hub or any Docker registry and updates the Docker Engine config file, which in turn provides password-free pushing and pulling of images to and from the registry.
docker (dynamic inventory)
Dynamically builds an inventory of all the available containers from a set of one or more Docker hosts.