浏览代码

Expand instructions on using systemd to manage containers

Signed-off-by: Tadej Janež <tadej.j@nez.si>
(cherry picked from commit c8a99a5054b2f890d56eda15adf478d4e70612b1)
Signed-off-by: Tibor Vass <tibor@docker.com>
Tadej Janež 9 年之前
父节点
当前提交
82219c7727
共有 1 个文件被更改,包括 13 次插入0 次删除
  1. 13 0
      docs/admin/host_integration.md

+ 13 - 0
docs/admin/host_integration.md

@@ -76,6 +76,10 @@ a new service that will be started after the docker daemon service has started.
     [Install]
     WantedBy=default.target
 
+If you intend to use this as a system service, put the above contents in a file
+in the `/etc/systemd/system` directory, e.g.
+`/etc/systemd/system/docker-redis_server.service`.
+
 If you need to pass options to the redis container (such as `--env`),
 then you'll need to use `docker run` rather than `docker start`. This will
 create a new container every time the service is started, which will be stopped
@@ -87,3 +91,12 @@ and removed when the service is stopped.
     ExecStop=/usr/bin/docker stop -t 2 redis_server
     ExecStopPost=/usr/bin/docker rm -f redis_server
     ...
+
+To start using the service, reload systemd and start the service:
+
+    systemctl daemon-reload
+    systemctl start docker-redis_server.service
+
+To enable the service at system startup, execute:
+
+    systemctl enable docker-redis_server.service