<p>Check the following:</p>

<p>Something like watchtower maybe running and monitoring your host machine on which the containers are running. Watchtower can re-pull your images from a registry and re-launch a container for you. There are some tools similar to watchtower which do this.</p>

CC BY-SA 3.0
2017-07-28T08:32:20.507Z
This sounds plausible, I've had this before with an in-house daemon that pulled images and created containers.
RichVel
CC BY-SA 3.0
2017-07-28T06:48:42.717Z
2017-07-28T06:48:42.717Z
lakshayk
<p>This can also com from swarm.
A look <a href="https://forums.docker.com/t/why-the-containers-are-being-recreated-and-they-can-not-be-removed/55560" rel="nofollow noreferrer">here</a> to find some more</p>

CC BY-SA 4.0
2023-02-11T18:53:12.733Z
Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Community
CC BY-SA 4.0
2023-02-11T18:30:51.010Z
2023-02-11T18:30:51.010Z
Max Alonzo
<p>I'm using ubuntu-16.04 desktop and installed <code>Docker-1.5-1</code> and <code>docker-engine-17.05.0~ce-0~ubuntu-xenial</code>, in which I installed <code>openmedicus/phplist</code>. My aim is to remove the container, and the image as well.</p>

<p>The issue is that the container is removed successfully but after some time the container is automatically created with a different container ID. </p>

<p>I even tried to remove images also but faced the same issue.</p>

<p>Trying to remove images:</p>

<pre><code>$ docker images | grep phplist
openmedicus/phplist             latest              24d3de5279cb        4 months ago        694MB

$ docker rmi openmedicus/phplist:latest --force
Untagged: openmedicus/phplist:latest
Untagged: penmedicus/phplist@sha256:6ac98b2f624eb8cd61b64c4b398650975a876224d5925175c58ff0c1b05a2593

$ docker images | grep phplist    ## Delete Sucessfully
</code></pre>

<p>Now trying to remove container :</p>

<pre><code>$ docker ps
b02b641560e8        24d3de5279cb             "/bin/sh -c /usr/s..."   2 minutes ago       Up 2 minutes        0.0.0.0:8080-&gt;80/tcp                                 
$ docker stop b02b641560e8
b02b641560e8

$ docker rm b02b641560e8 --force   # Remove Sucessfully
b02b641560e8
</code></pre>

<p>Again, the container is created automatically :</p>

<pre><code>$ docker ps
2c78199dc40c        openmedicus/phplist      "/bin/sh -c /usr/s..."   29 seconds ago      Up 28 seconds       0.0.0.0:8080-&gt;80/tcp                                 phplist
</code></pre>

<p>How can I remove the Docker container and image permanently?</p>

CC BY-SA 3.0
2017-07-10T11:31:14.660Z
I highly doubt an `apt-get install docker-engine` would end up running any container, so there's probably something else you did and omitted in this question.
Tensibai
CC BY-SA 3.0
2017-07-10T12:14:38.027Z
@Tensibai tried but not working
Nullpointer
CC BY-SA 3.0
2017-07-10T12:17:37.990Z
@nullpointer very strange behavior. Why isn't docker version 17 or so but 1.5?
docker --version
Ta Mu
CC BY-SA 3.0
2017-07-10T12:18:08.450Z
Tried what ? phplist is a mass mailing system, there's no chance it could get installed as a dependency. How did you install docker ?
Tensibai
CC BY-SA 3.0
2017-07-10T12:24:39.803Z
@Tensibai tried reinstall docker and docker-engine then again tried to remove container but still same issue, install docker with 'apt-get`
Nullpointer
CC BY-SA 3.0
2017-07-10T12:43:35.250Z
Maybe just because phplist doesn't come with docker at all ? We can't guess what you have installed/selected ... search for what is launching docker commands to run a phplist instance, probably another daemon or a cronjob somewhere
Tensibai
CC BY-SA 3.0
2017-07-10T12:53:50.483Z
@Tensibai see others container working fine means docker wokring fine. there is no cron for same, here I removed image as well as container of phplist then why created again even image removed ?
Nullpointer
CC BY-SA 3.0
2017-07-10T13:01:45.073Z
Just because there's something somewhere on your system doing a `docker run openmedicus/phplist`, check `/etc/systemd/system/docker-phplist.service` presence according to the docker-hub readme of the image you're listing: https://hub.docker.com/r/openmedicus/phplist/
Tensibai
CC BY-SA 3.0
2017-07-28T07:23:54.177Z
@Tensibai it's bit simple issue, `docker-phplist.service` was re-created the container. Now issue resolved. Thanks :)
Nullpointer
<docker><containers><linux>
After removing Docker container, why is it automatically re-created?
Nullpointer
# After removing Docker container, why is it automatically re-created?

(Asked by: username_0 on 2017-07-10)

I'm using ubuntu-16.04 desktop and installed Docker-1.5-1 and docker-engine-17.05.0~ce-0~ubuntu-xenial, in which I installed openmedicus/phplist. My aim is to remove the container, and the image as well.
The issue is that the container is removed successfully but after some time the container is automatically created with a different container ID. 
I even tried to remove images also but faced the same issue.
Trying to remove images:
$ docker images | grep phplist
openmedicus/phplist             latest              24d3de5279cb        4 months ago        694MB

$ docker rmi openmedicus/phplist:latest --force
Untagged: openmedicus/phplist:latest
Untagged: penmedicus/phplist@sha256:6ac98b2f624eb8cd61b64c4b398650975a876224d5925175c58ff0c1b05a2593

$ docker images | grep phplist    ## Delete Sucessfully

Now trying to remove container :
$ docker ps
b02b641560e8        24d3de5279cb             "/bin/sh -c /usr/s..."   2 minutes ago       Up 2 minutes        0.0.0.0:8080->80/tcp                                 
$ docker stop b02b641560e8
b02b641560e8

$ docker rm b02b641560e8 --force   # Remove Sucessfully
b02b641560e8

Again, the container is created automatically :
$ docker ps
2c78199dc40c        openmedicus/phplist      "/bin/sh -c /usr/s..."   29 seconds ago      Up 28 seconds       0.0.0.0:8080->80/tcp                                 phplist

How can I remove the Docker container and image permanently?

**Tags:** docker, containers, linux

> **Comments:**
> **username_1**: I highly doubt an `apt-get install docker-engine` would end up running any container, so there's probably something else you did and omitted in this question.  
> **username_0**: @username_1 tried but not working  
> **username_2**: @nullpointer very strange behavior. Why isn't docker version 17 or so but 1.5? docker --version  
> **username_1**: Tried what ? phplist is a mass mailing system, there's no chance it could get installed as a dependency. How did you install docker ?  
> **username_0**: @username_1 tried reinstall docker and docker-engine then again tried to remove container but still same issue, install docker with 'apt-get`  
> **username_1**: Maybe just because phplist doesn't come with docker at all ? We can't guess what you have installed/selected ... search for what is launching docker commands to run a phplist instance, probably another daemon or a cronjob somewhere  
> **username_0**: @username_1 see others container working fine means docker wokring fine. there is no cron for same, here I removed image as well as container of phplist then why created again even image removed ?  
> **username_1**: Just because there's something somewhere on your system doing a `docker run openmedicus/phplist`, check `/etc/systemd/system/docker-phplist.service` presence according to the docker-hub readme of the image you're listing: https://hub.docker.com/r/openmedicus/phplist/  
> **username_0**: @username_1 it's bit simple issue, `docker-phplist.service` was re-created the container. Now issue resolved. Thanks :)  

---

## 2 answers

### Answer by username_3 on 2017-07-28. Score: 1

Check the following:

Something like watchtower maybe running and monitoring your host machine on which the containers are running. Watchtower can re-pull your images from a registry and re-launch a container for you. There are some tools similar to watchtower which do this.

> **Comments:**
> **username_4**: This sounds plausible, I've had this before with an in-house daemon that pulled images and created containers.  

---

### Answer by username_5 on 2023-02-11. Score: 0

This can also com from swarm.
A look [here](https://forums.docker.com/t/why-the-containers-are-being-recreated-and-they-can-not-be-removed/55560) to find some more

> **Comments:**
> **username_6**: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).  

---

