Docker engine automatically starting containers

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

It is an argument for the docker run cli command:
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

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

Thank you verry much !!.

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)

With the two .doc files in .txt format

docker run --restart all.txt (4.4 KB)

log Docker.txt (108 KB)

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

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.

It’s in the attached log file:

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

1 Like

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

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

Ah, I see. I missed it.

Good Morning,

I based myself on the “Restart policies” documentation in 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.

2. docker run cmd.png

9. docker events .png

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)

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

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.

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 settingsto 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

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


Please, format your post according to the following guide: How to format your forum posts
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:

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