H
H
HexUserHex2020-01-19 14:19:40
Debian
HexUserHex, 2020-01-19 14:19:40

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

But after reboot, the containers will not start.
Second point, what is the easiest way to add ssl/tls support to portainer? Since it displays passwords in open form, it's just tin ....

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
OnYourLips, 2020-01-19
@HexUserHex

1. sudo docker run --restart=always -d your_image
2. Bind it to localhost. Walk through the ssh tunnel.

M
mureevms, 2020-01-19
@mureevms

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 question

Ask a Question

731 491 924 answers to any question