Answer a question

I have a container that I pretty much need every time when starting my development PC, so I am trying to get it to autostart.

I have already written a .bat file that works fine for starting the container once docker is up, and have put that into the autostart folder on windows but...

...when starting my PC, that .bat executes before docker has started running, and thus terminates without starting the container. Once docker is up and running, I can use the .bat manually to start it just fine.

So here's my question: Is there anything I can add to my .bat to tell it to wait for docker to be running before trying to start the container?

Currently, the bat simply says docker-compose up and nothing else.

Answers

Add

restart: unless-stopped

or

restart: always

to the container in your docker-compose.yml, then use docker-compose up manually once more. This will make Docker to start the container after Docker itself is started.

Logo

云原生社区为您提供最前沿的新闻资讯和知识内容

更多推荐