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,230 points
902 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,440 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
747 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
10,046 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 10, 2020 in Ansible by MD
• 95,440 points
3,711 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,440 points
1,138 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,090 points
2,472 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 8, 2020 in Ansible by MD
• 95,440 points
4,056 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,440 points
2,664 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP