How to remove a docker container using Ansible playbook?

0 votes

Hi Guys,

I have launch one container in remote system using Ansible playbook. Now I don't need this container. How can remove this container?

Sep 20 in Docker by akhtar
• 28,160 points
82 views

1 answer to this question.

0 votes

Hi@akhtar,

You can set the state=absent in your playbook. The docker_container module has the capability to control the state of a container as shown below.

- name: Stop a container
  docker_container:
    name: mycontainer
    state: absent
answered Sep 20 by MD
• 65,200 points

Related Questions In Docker

+4 votes
4 answers

How To Access a Service on Host From a Docker Container?

Adding to kalgi's answer, You can also ...READ MORE

answered Oct 16, 2018 in Docker by lina
• 8,220 points

edited Oct 16, 2018 by lina 16,564 views
0 votes
1 answer

How to run a docker command from inside the container?

You must have come across the /var/run/docker.sock file, ...READ MORE

answered Jun 28, 2018 in Docker by Sophie may
• 10,100 points
1,344 views
0 votes
2 answers
0 votes
2 answers

How to execute docker exec commande inside a docker container ?

You need to get inside the container ...READ MORE

answered Aug 13, 2019 in Docker by Sirajul
• 58,130 points
1,062 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,680 points
840 views
0 votes
1 answer

How can I connect a docker container to two docker networks that I have created?

Hi@akhtar, It's correct that the network argument of ...READ MORE

answered Mar 23 in Docker by MD
• 65,200 points
225 views
0 votes
1 answer

How to install packages in a Docker container?

Hi@akhtar, To install packages in a docker container, ...READ MORE

answered Apr 15 in Docker by MD
• 65,200 points
7,822 views