How to create a docker container using Ansible playbook

0 votes

Hi Guys,

I have configured the docker in my remote systems. I want to launch one container in remote systems using the Ansible playbook. How can I do that?

Aug 8, 2020 in Ansible by akhtar
• 38,230 points
4,054 views

1 answer to this question.

0 votes

Hi@akhtar,

You can use the docker_container module in Ansible. This module is used to create a docker container. I have attached one playbook below for your reference. 

  - name: Create a docker container
    docker_container:
      name: myos
      image: vimal13/apache-webserver-php
      ports:
        - "82:80"

You can also go through the Ansible document for more information.

https://docs.ansible.com/ansible/latest/modules/docker_container_module.html

answered Aug 8, 2020 by MD
• 95,440 points

Related Questions In Ansible

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 security group in AWS using Ansible-Playbook?

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

answered Aug 13, 2020 in Ansible by MD
• 95,440 points
3,413 views
0 votes
2 answers

How to create a directory in remote nodes using Ansible-Playbook?

You can read install and setup apache ...READ MORE

answered Aug 23, 2020 in Ansible by anonymous
• 160 points
3,638 views
0 votes
1 answer

How to create a user using Ansible Playbook?

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

answered Sep 1, 2020 in Ansible by MD
• 95,440 points
4,081 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,471 views
0 votes
1 answer

How to create a docker container 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
901 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,137 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