Answer the question
In order to leave comments, you need to log in
Autostart all docker containers after reboot in Debian 10?
It is required to configure autostart of all available containers in the system after the OS is rebooted.
I try like this: vi /etc/systemd/system.conf
add
#TEST AUTO_START
[Unit]
Description=Redis container
Requires=docker.service
After=docker.service
[Service]
Restart=always
ExecStart=/usr/bin/docker start -a $(docker ps -a -q)
ExecStop=/usr/bin/docker stop $(docker ps -q)
[Install]
WantedBy=local.target
Answer the question
In order to leave comments, you need to log in
1. sudo docker run --restart=always -d your_image
2. Bind it to localhost. Walk through the ssh tunnel.
You don't need to touch the Docker daemon to run containers. The fact is that the docker itself does not know what you need to raise after the reboot, and what not, and you just need to point it out to him. In addition, some containers need to be lifted, while others do not. Therefore, it makes no sense to raise everything, you just need to specify an additional flag at startup for the containers that should be raised. For example, a container is started with this command:
To restart, add --restart={{ flag for behavior }}, for example:
Read more about restart options in the documentation
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question