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 7 in Ansible by akhtar
• 25,030 points
170 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 7 by MD
• 56,480 points

Related Questions In Ansible

0 votes
0 answers

How to pull a docker image using Ansible playbook?

Hi Guys, I am new in Ansible. I ...READ MORE

Aug 4 in Ansible by akhtar
• 25,030 points
224 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 in Ansible by MD
• 56,480 points
129 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 in Ansible by anonymous
• 160 points
58 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 in Ansible by MD
• 56,480 points
35 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
• 57,640 points
775 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 6 days ago in Ansible by MD
• 56,480 points
22 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 in Ansible by MD
• 56,480 points
47 views