How to start a docker instance automatically

Docker can start a container calling docker start Name. The call can be set in the /etc/rc.local file so that it's done at start up.
When the container start is doesn't call the rc.local file. So it needs to be called right after starting the container in the host.

Example:

#!/bin/sh -e
docker start CONTAINER
# start rc local of the vm
docker exec -it CONTAINER bash -c "/etc/rc.local"

exit 0

References:

Docker

Share this article:

Recent Comments