How to Auto-start ERPNext on Boot in Docker

One thing I like in ERPNext production mode is that ERPNext automatically starts up on boot and shuts down on Linux shutdown.

How can we do this in docker?

Did you try dockers manual ?
Normally i use --restart= when making any container with important services

You can check dockers restart policies here

Good luck.

I think restart here refers to processes that may die while the server is on.

In my case, the server gets shutdown and booted up every day.

In production mode, ERPNext server starts up automatically.
In docker you have to issue some command line commands to start it.
Can docker have this auto-startup of ERPNext?

It should work even after reboot

docker-compose : Overview | Docker Docs
docker swarm : Overview | Docker Docs


It may be good to add this restart policy instruction to the ERPNext docker readme instructions

Does docker gracefully close when the server receives a shutdown signal?

docker stop tries to gracefully close containers for 10 sec. I didn’t know this, I checked docker documentation. Docker has a vast community and documentation to refer. I think when systemctl stops docker, docker stops containers. I’ve not used docker on a host which reboots everyday.

1 Like

refer the link,

Shared video is a way to auto start non-docker frappe-bench on OS startup.

To auto-start docker use docker-compose, docker-swarm or any orchestrator to manage the containers.

The question is where to put restart: unless-stopped in erpnext-one.yaml file. More precisely, for which service image?

Looking at the startup it seems like redis services don’t depend on anything, so they can be restarted gracefully. However, all other services depend on configurator. While configurator depends on the three (3) redis services.

I put restart: unless-stopped to all services except configurator. Now it works well.

1 Like