Nginx Reverse Proxy Manager on Raspberry Pi 4 doesn't automatically start up after reboot
Host -- docker service level
Update: the initial answer works within docker itself. If you want docker itself to also start on boot, then that's a different story. You should be able to do that with:
sudo systemctl enable docker.servicesudo systemctl enable containerd.service
VM -- docker container level (nginx)
You can definitely start nginx service on boot.
The commands are self-explanatory -- enable, disable, and check status of running nginx on boot:
sudo systemctl enable nginxsudo systemctl disable nginxsudo systemctl status nginx
Resources:
If this is not available at your disposal, let me know and I'll try to find other ways and update my answer.
You can also edit the YML file to say "restart: always
" in the "services:
"
for example like this:
version: '3'services: postgresql: image: postgres:9.6.6 ports: - 9932:5432 expose: - "5432" environment: - POSTGRES_PASSWORD=pass restart: always volumes: - /data:/var/lib/postgresql/data myapp: image: myapp links: - postgresql depends_on: - "postgresql" restart: always ports: - "5000:5000"
I would also recommend adding your specific docker-compose as a service using this service directory:
/etc/systemd/system/
In here simply create the file using nano or vim. The filename is not important, however, it needs to be a ".service" file, so I recommend the name "docker-compose-app.service
"
[Unit]Description=Docker Compose Application ServiceRequires=docker.serviceAfter=docker.service[Service]WorkingDirectory=/wherever/your/docker-compose/file/isExecStart=/usr/local/bin/docker-compose upExecStop=/usr/local/bin/docker-compose downTimeoutStartSec=0Restart=on-failureStartLimitIntervalSec=60StartLimitBurst=3[Install]WantedBy=multi-user.target
(WorkingDirectory = wherever your docker-compose file is, please change!)
All you then need to do is:
systemctl enable docker-compose-app
(If you've given it a different file name, use that name here)
And just to be sure:
sudo systemctl enable docker
This is a StackOverflow question which might help you answer your problem
How the restart: always policy works.