Member-only story

How to manage docker-compose with ansible ?

Xavier Pestel (Xavki)
2 min readSep 28, 2021

--

In a previous post, we discovered how to install a prometheus/grafana stack with ansible. Many of you have read and it’s a pleasure for me to write a new post on ansible.

In this post, we are going to see the docker-compose module. A very simple ansible module which can allow to run, build or remove some docker services. Each service runs one or many docker containers of course.

If you want, you can follow the documentation about this module.

Main parameters for beginners

  • build : to add a build step (with Dockerfile path)
  • definition : to define the docker-compose in this section
  • dependencies : to create a dependancy with another service
  • docker_host : which docker socket to use (unix/ssh/tcp)
  • files : docker-compose list
  • nocache : to build an image without cache (rebuild)
  • pull : to pull images before to start
  • remove_images : to remove the local image (on target server)
  • remove_orphans : to remove all containers not manage by docker-compose

--

--

Xavier Pestel (Xavki)
Xavier Pestel (Xavki)

Written by Xavier Pestel (Xavki)

Microservices architecture and opensource. I’m maintainer of xavki https://youtube.com/c/xavki-linux about opensource. My blog : https://xavki.blog/

No responses yet