I have a Docker container managed with Docker compose, which defines the
unless-stopped restart policy. But my container never starts after I reboot the machine. But it does restart if I just restart the Docker service. I have a similar setup on another machine which I have no issues with.
I kept on searching the issue until it hit me all of a sudden. I’m using secrets read from files. The files are in the
/tmp directory which gets cleared, thus the container fails to start.
When I defined the secrets files, I just threw them away from the source code repository, without thinking too much where. I wasn’t even sure if I was going to use them for a long time.