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,260 points
4,322 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,460 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,862 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,460 points
3,824 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
4,274 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,460 points
4,494 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,020 points
2,715 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,460 points
1,129 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,460 points
1,451 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