Container Linux (CoreOS) doesn't enable the docker systemd service by default. If you start a container with the --restart=always
flag, for example, your container will not start up again automatically after a reboot. This may be desirable if you're running a cluster with an orchestration system that will handle this for you, but if you are using Container Linux with a single instance you might want your containers to start up by themselves. Of course you can easily enable to systemd service from the command line, but the best way is to pass an Ignition config file during the droplet creation process.
- Under the "Select additional options" section, select "User Data"
- In the box, paste the following Ignition config
{
"ignition": { "version": "2.2.0" },
"systemd": {
"units": [{
"name": "docker.service",
"enable": true
}]
}
}
Now docker should start every time Container Linux (CoreOS) reboots and start any containers that have the appropriate --restart
option set.
This is a very helpful fix for an issue that has plagued me for a long time. Thanks!