mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Update sample systemd for container
1. Docker require to run before redis container run. 2. 'start' command can not accept more options like "run -e xx ..." 3. Remove wrong command 'Author=' Signed-off-by: Daniel YC Lin <dlin.tw@gmail>
This commit is contained in:
parent
bac58e9711
commit
8c19e43dff
1 changed files with 11 additions and 2 deletions
|
@ -59,18 +59,27 @@ a new service that will be started after the docker daemon service has started.
|
|||
/usr/bin/docker start -a redis_server
|
||||
end script
|
||||
|
||||
|
||||
### systemd
|
||||
|
||||
[Unit]
|
||||
Description=Redis container
|
||||
Author=Me
|
||||
Requires=docker.service
|
||||
After=docker.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
ExecStart=/usr/bin/docker start -a redis_server
|
||||
# for more options, use 'run' instead of 'start', but not suggested
|
||||
# ExecStart=/usr/bin/docker run redis_server
|
||||
ExecStop=/usr/bin/docker stop -t 2 redis_server
|
||||
|
||||
[Install]
|
||||
WantedBy=local.target
|
||||
|
||||
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'.
|
||||
|
||||
[Service]
|
||||
...
|
||||
ExecStart=/usr/bin/docker run --env foo=bar redis_server
|
||||
...
|
||||
|
|
Loading…
Add table
Reference in a new issue