start docker as systemd on centos7/rhel7

Here is an example how you can start a docker container as a service. After reboot this docker instance will be started.
Create a service file like this: 


Description=Redis Docker Container 







ExecStart=/bin/docker run -d –name redis redis

ExecStop=/bin/docker stop -t 2 redis 

ExecStopPost=/bin/docker rm -f redis




test it with the following command:

systemctl start redis

stop it with: systemctl stop redis

make this permanent with systemctl enable redis

Leave a Reply

Your email address will not be published. Required fields are marked *