How to manage docker-compose with ansible ?

Main parameters for beginners

Example of ansible code for docker-compose

- name: copy docker-compose.yml
copy:
src: app/
dest: tmp/
- name: test docker-compose
docker_compose:
project_src: tmp/
state: present
- name: test docker-compose
docker_compose:
project_src: tmp/
state: present
scale:
app: 4
- name: test docker-compose
docker_compose:
project_src: tmp/
state: absent
- name: test docker-compose
docker_compose:
project_name: mynginx
definition:
version: "3.7"
services:
app:
image: nginx:latest
- name: copy docker-compose
copy:
src: app/
dest: /tmp/app
- name: run comporse
docker_compose:
project_name: mynginx
definition:
version: "3.7"
services:
app:
build: "/tmp/app/"
ports:
- 8888:8080

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store