# Docker engine automatically starting containers

**URL:** <https://forums.docker.com/t/docker-engine-automatically-starting-containers/140667>\
**Category:** Docker Desktop\
**Tags:** windows\
**Created:** [April 3, 2024, 4:37pm UTC](https://forums.docker.com/t/docker-engine-automatically-starting-containers/140667 "2024-04-03T16:37:55Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![vnoir](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/vnoir/32/34292_2.png) [@vnoir](https://forums.docker.com/u/vnoir)\
**Post date:** [April 3, 2024, 4:37pm UTC](https://forums.docker.com/t/docker-engine-automatically-starting-containers/140667/1 "2024-04-03T16:37:55Z")

</div>

Hi everyone.  
When computer start or restart, Docker Engine also start but not the container (CodePriject/ai-server) witch must be started manually.  
In the event of absence, this quickly leads to a saturation of alarm messages witch ends up blocking the computer.  
There are similar topics about that (for example “General discussions docker Aug 2023”, but I do not known where is the option “-restart=always” for a container.

Can anyone help me as I’m far from being a computer expert…

Many thanks in advance.

Windows 11 pro last version  
Docker Desktop last version (V4.28.0)  
WSL2 based engine (WSL2-Kernel), virtualisation, …  
CUDA 11.7 win 11 64bits  
Subsystem for LINUX

---

<div class="post-metadata">

**Author:** ![meyay](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/meyay/32/34000_2.png) [@meyay](https://forums.docker.com/u/meyay)\
**Post date:** [April 3, 2024, 4:51pm UTC](https://forums.docker.com/t/docker-engine-automatically-starting-containers/140667/2 "2024-04-03T16:51:17Z")

</div>

> [@vnoir](#):
>
> but I do not known where is the option “-restart=always” for a container

It is an argument for the `docker run` cli command:  
[https://docs.docker.com/reference/cli/docker/container/run/#restart](https://docs.docker.com/reference/cli/docker/container/run/#restart)

Of course the same exists for docker compose:  
[https://docs.docker.com/compose/compose-file/05-services/#restart](https://docs.docker.com/compose/compose-file/05-services/#restart)

---

<div class="post-metadata">

**Author:** ![vnoir](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/vnoir/32/34292_2.png) [@vnoir](https://forums.docker.com/u/vnoir)\
**Post date:** [April 3, 2024, 6:03pm UTC](https://forums.docker.com/t/docker-engine-automatically-starting-containers/140667/3 "2024-04-03T18:03:19Z")

</div>

I think it’s working ! I have to check that in details.

Thank you verry much !!.

---

<div class="post-metadata">

**Author:** ![vnoir](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/vnoir/32/34292_2.png) [@vnoir](https://forums.docker.com/u/vnoir)\
**Post date:** [April 3, 2024, 6:48pm UTC](https://forums.docker.com/t/docker-engine-automatically-starting-containers/140667/4 "2024-04-03T18:48:40Z")

</div>

It is a disaster! there is no more AI. There is no longer a port indicated. Do you know why?

My docker run command seems not to be with all necessary parameters…

And how do I recover the previous container that I deleted in Docker desktop?

(Attachment docker run --restart all.doc is missing)

(Attachment log Docker.doc is missing)

 ![no more ports.png](https://global.discourse-cdn.com/docker/original/3X/4/b/4bad5c31cab93ee6411b59727ed8e107a9c8cadc.png)

---

<div class="post-metadata">

**Author:** ![vnoir](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/vnoir/32/34292_2.png) [@vnoir](https://forums.docker.com/u/vnoir)\
**Post date:** [April 3, 2024, 6:56pm UTC](https://forums.docker.com/t/docker-engine-automatically-starting-containers/140667/5 "2024-04-03T18:56:46Z")

</div>

With the two .doc files in .txt format

[docker run --restart all.txt](https://forums.docker.com/uploads/short-url/uYws7zLNkCdaIQtasmUgiMfmYYg.txt) (4.4 KB)

[log Docker.txt](https://forums.docker.com/uploads/short-url/i5Gy981UoZKuqBoM92i8BdQVhFl.txt) (108 KB)

---

<div class="post-metadata">

**Author:** ![rimelek](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rimelek/32/41602_2.png) [@rimelek](https://forums.docker.com/u/rimelek)\
**Post date:** [April 3, 2024, 8:38pm UTC](https://forums.docker.com/t/docker-engine-automatically-starting-containers/140667/6 "2024-04-03T20:38:00Z")

</div>

> [@vnoir](#):
>
> There is no longer a port indicated. Do you know why?

What port? You didn’t share what command you ran before adding the restart policy and didn’t mention any port.

> [@vnoir](#):
>
> And how do I recover the previous container that I deleted in Docker desktop?

You can’t. But why would it be deleted? How is that related to staring containers automatically? You will need to share more context in order to get better answers.

---

<div class="post-metadata">

**Author:** ![meyay](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/meyay/32/34000_2.png) [@meyay](https://forums.docker.com/u/meyay)\
**Post date:** [April 3, 2024, 9:07pm UTC](https://forums.docker.com/t/docker-engine-automatically-starting-containers/140667/7 "2024-04-03T21:07:36Z")

</div>

It’s in the attached log file:

```auto
docker run --restart=always codeproject/ai-server:gpu

```

You started a container without a volume, and therefore without a way to persist the data outside the container.

Of course, deleting a container without volumes will result in a deletion of the container filesystem → all data from the container is gone.That’s why people use volumes to persist application data outside the container: [https://docs.docker.com/reference/cli/docker/container/run/#volume](https://docs.docker.com/reference/cli/docker/container/run/#volume)

---

<div class="post-metadata">

**Author:** ![rimelek](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rimelek/32/41602_2.png) [@rimelek](https://forums.docker.com/u/rimelek)\
**Post date:** [April 3, 2024, 9:12pm UTC](https://forums.docker.com/t/docker-engine-automatically-starting-containers/140667/8 "2024-04-03T21:12:12Z")

</div>

> [@meyay](#):
>
> It’s in the attached log file:

I know that this docker run command was in the log file, but I meant

> [@rimelek](#):
>
> before adding the restart policy

In case there was a port mapping before that. So I was looking for what port should we look for 🙂

---

<div class="post-metadata">

**Author:** ![meyay](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/meyay/32/34000_2.png) [@meyay](https://forums.docker.com/u/meyay)\
**Post date:** [April 3, 2024, 9:21pm UTC](https://forums.docker.com/t/docker-engine-automatically-starting-containers/140667/9 "2024-04-03T21:21:21Z")

</div>

Ah, I see. I missed it.

---

<div class="post-metadata">

**Author:** ![vnoir](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/vnoir/32/34292_2.png) [@vnoir](https://forums.docker.com/u/vnoir)\
**Post date:** [April 4, 2024, 4:12pm UTC](https://forums.docker.com/t/docker-engine-automatically-starting-containers/140667/10 "2024-04-04T16:12:36Z")

</div>

Good Morning,

I based myself on the “Restart policies” documentation in [http://docs.docker.com/reference/cli/docker/container/run/#restart](http://docs.docker.com/reference/cli/docker/container/run/#restart).

I am a little lost. I started the whole process again today but the result is not good. Attached are screenshots in chronological order of what I did today.

The first one (docker desktop before) is the container ( hardcore-spence) that is working perfectly and that i want to restart auto.

2 docker run command with restart and port options

3 and 4 the run

5 docker desktop after run : a new container is build (vigorous-chaplygin) but without the ports è why?

6 docker ps : there is no ‘UP ‘ or ‘Restarting’ for that new container

7 docker desktop images with optional settings to have the ports 3218:32168

8 docker desktop : there is AGAIN a new container (silly- mendeleev) whitch is working ok

9 docker event = nothing to see

10 after restart the computer : **it restart not the good one** (silly-mendeleev) **but the first on created** (vigourous-chaplygin) , that without port -à not working

11 desktop ps: again without ‘UP ‘ or ‘Restarting’ for that container

Can you help me ?

Vincent.

 ![1. docker desktop before.png](https://global.discourse-cdn.com/docker/original/3X/5/6/56d647539ebacf5a3314dfb1b55dc1f9d11621a3.png)

![2. docker run cmd.png](https://global.discourse-cdn.com/docker/original/3X/1/1/1165aa1336a06ecc446587fc40273d0dd0980e4e.png)

 ![3. windows powerschell ISE page1 .png](https://global.discourse-cdn.com/docker/original/3X/3/8/38e7afcbe4f62683b7723c1a8fae28f834603f10.png)

 ![4. windows powerschell ISE page2 .png](https://global.discourse-cdn.com/docker/original/3X/b/1/b1b0debc8cd758e1a5239b35c6570185e92861f4.png)

 ![5. docker desktop after run cmd .png](https://global.discourse-cdn.com/docker/original/3X/a/9/a995dcbbfbd228a1b773b3cd03d562df2cb25fcb.png)

 ![7. docker images optional settings.png](https://global.discourse-cdn.com/docker/original/3X/c/4/c4f36811eba3169e7ed9cb6db86c928ffb3f758f.png)

 ![8. docker desktop after optional settings.png](https://global.discourse-cdn.com/docker/original/3X/a/a/aa7e5d1ca1d957ff5c5b68288567f5db6797c785.png)

![9. docker events .png](https://global.discourse-cdn.com/docker/original/3X/c/e/cec8baafb5a460a732ea0d00270cb9a665b640a3.png)

 ![10. docker desctop after restart restart not the good container.png](https://global.discourse-cdn.com/docker/original/3X/c/a/caebd989d0a6defa2ea2e1aa14463e673fc5a760.png)

 ![11 docker ps restarted container.png](https://global.discourse-cdn.com/docker/original/3X/f/9/f9f89f88889cdd58ab3929012641fd35b54702ce.png)

 ![6. docker ps.png](https://global.discourse-cdn.com/docker/original/3X/e/f/ef1cb6dc9d937b60f4f18117d316017109c8fb87.png)

---

<div class="post-metadata">

**Author:** ![vnoir](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/vnoir/32/34292_2.png) [@vnoir](https://forums.docker.com/u/vnoir)\
**Post date:** [April 4, 2024, 6:06pm UTC](https://forums.docker.com/t/docker-engine-automatically-starting-containers/140667/11 "2024-04-04T18:06:03Z")

</div>

In transmitted file #3 (the run of docker run command) there is a line starting with “Warn Overriding address(es) ‘http://+:32168, http://+:5000’ Binding to endport… …”

What does it mean?

Hence two questions:

1. Is this why the container created (vigorous-chaplyngin) does not have the port requested (32168:32168) in the run command? If this is indeed the case, where is my error in the docker run command?

2. Why in docker ps, it does not indicate the ‘up’ or ‘restarting’ flag? Which nevertheless seems to work (see transmitted file #10 and 11)

---

<div class="post-metadata">

**Author:** ![meyay](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/meyay/32/34000_2.png) [@meyay](https://forums.docker.com/u/meyay)\
**Post date:** [April 4, 2024, 7:57pm UTC](https://forums.docker.com/t/docker-engine-automatically-starting-containers/140667/12 "2024-04-04T19:57:39Z")

</div>

> [@vnoir](#):
>
> I based myself on the “Restart policies” documentation in [docker run | Docker Docs](http://docs.docker.com/reference/cli/docker/container/run/#restart).

I hope so 🙂 The comment in my last post is a response to @rimeleks post.

> [@vnoir](#):
>
> Attached are screenshots in chronological order of what I did today.

Please do not post text content as screenshot. It makes it unnecessary hard to read. I personally don’t look at them, as they are inconvenient to read.

Also, please format the commands and output properly, by wrapping them in a Preformated text block (\</\> icon, for some people hidden underneath the menu of the gear icon).

Once you post the details properly formatted, I will take a look.

---

<div class="post-metadata">

**Author:** ![vnoir](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/vnoir/32/34292_2.png) [@vnoir](https://forums.docker.com/u/vnoir)\
**Post date:** [April 7, 2024, 3:52pm UTC](https://forums.docker.com/t/docker-engine-automatically-starting-containers/140667/13 "2024-04-07T15:52:53Z")

</div>

HI,  
I don’t understand what you mean by “a Preformated text block (\</\> icon, for some people hidden underneath the menu of the gear icon)”. I don’t know how to do this.

Anyway, here, in text and without copying logs and without screenshots, is what is happening:

1. I have running in Docker Desktop cli container:

name: **hardcore-spence** ; image: **codeproject/ai-server:gpu** ; running; ports: **32168:32168**

It’s running perfectly but no restart auto

1. I run this command to have restart (run) auto a container when computer restart:

**c:\windows\system32\> docker run --restart=always codeproject/ai-server:gpu --32168:32168**

1. Powershell give me a line:

**“Warni Overriding address(es) ‘http://+:32168, http://+:5000’. Binding to endpoints defined via IConfiguration and/or UseKestrel() instead.”**

1. Docker build a new container

name: **vigorous-chplyngin** ; image: **codeproject/ai-server:gpu** ; running; ports: ( **none** ).

there are no ports: I can’nt use it.

1. Moreover, there is no “UP” or “Restarting” in Docker ps …

2. in Docker images, for “codeproject/ai-server:gpu” I used “ **optional settings** ” **to add Host port 32168:32168**

3. System build again a new container

name: **silly-mendeleev** ; image: **codeproject/ai-server:gpu** ; running; ports: **32168:32168**

It’s running perfectly but **no restart auto**

So here are my questions

- **What means the warning from Powrschell (point 3)?**

- Why is there no UP" or “Restarting” in Docker ps (point 6)?

- **Wich is the full and correct command line for the restart=always option WITH the port 32168:32168 port**

Is there anyone who can help me with this?  
Say me if you need more info.  
**Vincent**

---

<div class="post-metadata">

**Author:** ![vnoir](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/vnoir/32/34292_2.png) [@vnoir](https://forums.docker.com/u/vnoir)\
**Post date:** [April 8, 2024, 2:42pm UTC](https://forums.docker.com/t/docker-engine-automatically-starting-containers/140667/14 "2024-04-08T14:42:55Z")

</div>

Note: adding in the docker run command **–add-host 32168:32168** dit n’t change anything. Same warning and no adding port.

---

<div class="post-metadata">

**Author:** ![rimelek](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rimelek/32/41602_2.png) [@rimelek](https://forums.docker.com/u/rimelek)\
**Post date:** [April 8, 2024, 11:02pm UTC](https://forums.docker.com/t/docker-engine-automatically-starting-containers/140667/15 "2024-04-08T23:02:24Z")

</div>

> [@vnoir](#):
>
> I don’t understand what you mean by “a Preformated text block (\</\> icon, for some people hidden underneath the menu of the gear icon)”. I don’t know how to do this.

* * *

Please, format your post according to the following guide: [How to format your forum posts](https://forums.docker.com/t/how-to-format-your-forum-posts/127295)  
In short: please, use `</>` button to share codes, terminal outputs, error messages or anything that can contain special characters which would be interpreted by the MarkDown filter. Use the preview feature to make sure your text is formatted as you would expect it and check your post after you have sent it so you can still fix it.

Example code block:

````auto
```
echo "I am a code."
echo "An athletic one, and I wanna run."
```

````

* * *
