How to create a docker container using Ansible

0 votes

Hi Guys,

I am trying to launch one docker container using the Ansible playbook. How can I do that?

Sep 20, 2020 in Ansible by akhtar
• 38,180 points
172 views

1 answer to this question.

0 votes

Hi@akhtar,

You can use the docker_container module in Ansible. This module will connect to the Docker server and launch the container. You can see the below playbook.

- name: Run redis container
  docker_container:
    name: myredis
    image: redis
    command: redis-server --appendonly yes
    state: started
    exposed_ports:
      - 6379
    volumes_from:
      - mydata
answered Sep 20, 2020 by MD
• 95,140 points

Related Questions In Ansible

0 votes
1 answer

How to create a new encrpted file using Ansible Vault?

If you are creating a new file ...READ MORE

answered Jan 29, 2019 in Ansible by Kyraa
235 views
0 votes
1 answer

How to pull a docker image using Ansible playbook?

Did you try using this? https://docs.ansible.com/ansible/latest/colle ...READ MORE

answered Nov 5, 2020 in Ansible by undermink
2,108 views
0 votes
1 answer

How to create a directory using Ansible?

Hi@akhtar, You can use the file module. To ...READ MORE

answered Aug 9, 2020 in Ansible by MD
• 95,140 points
656 views
0 votes
1 answer

How to create a key pair on AWS using Ansible-Playbook?

Hi@akhtar, You can find the ec2_key module in ...READ MORE

answered Aug 12, 2020 in Ansible by MD
• 95,140 points
192 views
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,100 points
1,112 views
0 votes
1 answer

How to create a docker container using Ansible playbook?

Hi@akhtar, You can use the docker_container module in ...READ MORE

answered Aug 7, 2020 in Ansible by MD
• 95,140 points
1,979 views
0 votes
1 answer

How to start a docker container with healthstatus using Ansible?

Hi@akhtar, You can use the docker_container module in ...READ MORE

answered Sep 20, 2020 in Ansible by MD
• 95,140 points
380 views