1. create and edit a systemd service file – I advise to set a naming convention:
vi /etc/systemd/system/docker.dockerContainerName.service
2. with the following content:
[Unit] Description=DockerContainerName Container After=docker.service Requires=docker.service [Service] TimeoutSec=0 Restart=always ExecStart=/usr/bin/docker start -a dockerContainerName ExecStop=/usr/bin/docker stop -t 2 dockerContainerName [Install] WantedBy=local.target
3. start and enable the service
systemctl start docker.containerName.service systemctl enable docker.containerName.service