<p>I have created a swarm service, it will keep recreating the container everytime it fails, which is expected and The certbot service is constantly failing.</p>
<p>I disabled swarm mode with below command and re-initialized swarm again and my problem has been solved.</p>
<pre><code>docker swarm leave --force
docker swarm init
</code></pre>

CC BY-SA 4.0
2024-02-29T12:48:54.997Z
2024-02-29T12:48:54.997Z
Arani
<p>I would check the logs and see if something is notable there first.</p>
<pre><code> # docker logs 459979a55425
    [2024-01-30 23:56:18 +0000] [1] [INFO] Starting gunicorn 21.2.0
    [2024-01-30 23:56:18 +0000] [1] [INFO] Listening at: http://0.0.0.0:5000 (1)
    [2024-01-30 23:56:18 +0000] [1] [INFO] Using worker: sync
    ...
</code></pre>
<p>And try monitoring <code>events</code> while the container is active. This would need to be run in another terminal:</p>
<pre><code># docker events
2024-02-29T06:59:09.512867172-06:00 network connect ...(container=...b7fda34f83a, name=bridge, type=bridge)
...
</code></pre>
<p>The check if there is a restart policy for some reason (<a href="https://docs.docker.com/config/containers/start-containers-automatically/" rel="nofollow noreferrer">https://docs.docker.com/config/containers/start-containers-automatically/</a>).</p>
<pre><code># docker inspect 413071a51305
           ...
           &quot;RestartPolicy&quot;: {
                &quot;Name&quot;: &quot;no&quot;,
                &quot;MaximumRetryCount&quot;: 0
            },
            ...     
</code></pre>
<p>If restart is set to <code>always</code> or similar, you can change it with something like below. There is more in the link above:</p>
<pre><code>docker update --restart=no 459979a55425
</code></pre>

CC BY-SA 4.0
2024-02-29T12:57:59.527Z
2024-02-29T12:57:59.527Z
Nstevens
<p>I'm newbie in docker. I use below command to run the certbot image twice:</p>
<pre><code>docker run --rm certbot/certbot
</code></pre>
<p>I'd like to stop it but I can't. This command has started to produce many containers and these containers are automatically closed and produced again.</p>
<p>I have done the following:</p>
<p>1.Remove and kill containers</p>
<pre><code>docker rm -f $(docker ps -a -q)
docker kill $(docker ps -q)
</code></pre>
<p>2.Through the following command, I tried to get the ID process and kill it:</p>
<pre><code>ps aux | grep &lt;containerId&gt; | awk '{print $1 $2}'
</code></pre>
<p>then</p>
<pre><code>kill -9 &lt;processId&gt;  
</code></pre>
<p>But the ID process keeps changing.</p>
<p>3.I restarted Docker, even rebooted the whole server but still the problem persists.</p>
<p>I posted a screen record gif that shows that containers are constantly generated with different IDs and are automatically deleted.</p>
<p><a href="https://i.sstatic.net/o4DX6.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/o4DX6.gif" alt="ScreenRecord" /></a></p>
<p>How to resolve this problem?</p>
<p>Docker version 24.0.2, build cb74dfc<br />
CentOS Linux release 7.9.2009 (Core)</p>

<docker><docker-swarm><images><centos><certbot>
how to stop "docker run -it certbot/certbot"?
Arani
# how to stop "docker run -it certbot/certbot"?

(Asked by: username_0 on 2024-02-29)

I'm newbie in docker. I use below command to run the certbot image twice:
docker run --rm certbot/certbot

I'd like to stop it but I can't. This command has started to produce many containers and these containers are automatically closed and produced again.
I have done the following:
1.Remove and kill containers
docker rm -f $(docker ps -a -q)
docker kill $(docker ps -q)

2.Through the following command, I tried to get the ID process and kill it:
ps aux | grep  | awk '{print $1 $2}'

then
kill -9   

But the ID process keeps changing.
3.I restarted Docker, even rebooted the whole server but still the problem persists.
I posted a screen record gif that shows that containers are constantly generated with different IDs and are automatically deleted.

How to resolve this problem?
Docker version 24.0.2, build cb74dfc
CentOS Linux release 7.9.2009 (Core)

**Tags:** docker, docker-swarm, images, centos, certbot


---

## 2 answers

### Answer by username_0 on 2024-02-29. Score: 0 | Accepted answer

I have created a swarm service, it will keep recreating the container everytime it fails, which is expected and The certbot service is constantly failing.
I disabled swarm mode with below command and re-initialized swarm again and my problem has been solved.
docker swarm leave --force
docker swarm init


---

### Answer by username_1 on 2024-02-29. Score: 0

I would check the logs and see if something is notable there first.
 # docker logs 459979a55425
    [2024-01-30 23:56:18 +0000] [1] [INFO] Starting gunicorn 21.2.0
    [2024-01-30 23:56:18 +0000] [1] [INFO] Listening at: http://0.0.0.0:5000 (1)
    [2024-01-30 23:56:18 +0000] [1] [INFO] Using worker: sync
    ...

And try monitoring events while the container is active. This would need to be run in another terminal:
# docker events
2024-02-29T06:59:09.512867172-06:00 network connect ...(container=...b7fda34f83a, name=bridge, type=bridge)
...

The check if there is a restart policy for some reason (https://docs.docker.com/config/containers/start-containers-automatically/).
# docker inspect 413071a51305
           ...
           "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            ...     

If restart is set to always or similar, you can change it with something like below. There is more in the link above:
docker update --restart=no 459979a55425


---

