Signed-off-by: Tadej Janež <tadej.j@nez.si>
| ... | ... |
@@ -76,6 +76,10 @@ a new service that will be started after the docker daemon service has started. |
| 76 | 76 |
[Install] |
| 77 | 77 |
WantedBy=local.target |
| 78 | 78 |
|
| 79 |
+If you intend to use this as a system service, put the above contents in a file |
|
| 80 |
+in the `/etc/systemd/system` directory, e.g. |
|
| 81 |
+`/etc/systemd/system/docker-redis_server.service`. |
|
| 82 |
+ |
|
| 79 | 83 |
If you need to pass options to the redis container (such as `--env`), |
| 80 | 84 |
then you'll need to use `docker run` rather than `docker start`. This will |
| 81 | 85 |
create a new container every time the service is started, which will be stopped |
| ... | ... |
@@ -86,3 +90,12 @@ and removed when the service is stopped. |
| 86 | 86 |
ExecStart=/usr/bin/docker run --env foo=bar --name redis_server redis |
| 87 | 87 |
ExecStop=/usr/bin/docker stop -t 2 redis_server ; /usr/bin/docker rm -f redis_server |
| 88 | 88 |
... |
| 89 |
+ |
|
| 90 |
+To start using the service, reload systemd and start the service: |
|
| 91 |
+ |
|
| 92 |
+ systemctl daemon-reload |
|
| 93 |
+ systemctl start docker-redis_server.service |
|
| 94 |
+ |
|
| 95 |
+To enable the service at system startup, execute: |
|
| 96 |
+ |
|
| 97 |
+ systemctl enable docker-redis_server.service |