diff options
author | B. van Berkum <dev@dotmpe.com> | 2017-10-03 00:57:46 +0200 |
---|---|---|
committer | B. van Berkum <dev@dotmpe.com> | 2017-10-03 00:57:46 +0200 |
commit | 62a8b0ff6eafddcd091e3f6676b258f44b5f9e5c (patch) | |
tree | 93cc61f642ec587f817f37b423238cfb56165e7d /doc/md/docker | |
parent | 60ed9b8f4142e99114661b5b8a5562aa75bffb48 (diff) | |
download | Shaarli-62a8b0ff6eafddcd091e3f6676b258f44b5f9e5c.tar.gz Shaarli-62a8b0ff6eafddcd091e3f6676b258f44b5f9e5c.tar.zst Shaarli-62a8b0ff6eafddcd091e3f6676b258f44b5f9e5c.zip |
Docker-101: added working systemd config example
Diffstat (limited to 'doc/md/docker')
-rw-r--r-- | doc/md/docker/docker-101.md | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/doc/md/docker/docker-101.md b/doc/md/docker/docker-101.md index 271dcd5b..35a68774 100644 --- a/doc/md/docker/docker-101.md +++ b/doc/md/docker/docker-101.md | |||
@@ -84,6 +84,11 @@ Note the names and ID's of containers are list in ``docker ps``. You an even typ | |||
84 | 84 | ||
85 | Access can also be through one or more network ports, or disk volumes. Both are specified on and fixed on ``docker create`` or ``run``. | 85 | Access can also be through one or more network ports, or disk volumes. Both are specified on and fixed on ``docker create`` or ``run``. |
86 | 86 | ||
87 | You can view the console output of the main container process too: | ||
88 | ```bash | ||
89 | $ docker logs -f <container-name-or-id> | ||
90 | ``` | ||
91 | |||
87 | ### Docker disk use | 92 | ### Docker disk use |
88 | Trying out different images can fill some gigabytes of disk quickly. Besides images, the docker volumes usually take up most disk space. | 93 | Trying out different images can fill some gigabytes of disk quickly. Besides images, the docker volumes usually take up most disk space. |
89 | 94 | ||
@@ -93,3 +98,45 @@ If you care only about trying out docker and not about what is running or saved, | |||
93 | $ docker rmi -f $(docker images -aq) # remove or mark all images for disposal | 98 | $ docker rmi -f $(docker images -aq) # remove or mark all images for disposal |
94 | $ docker volume rm $(docker volume ls -q) # remove all volumes | 99 | $ docker volume rm $(docker volume ls -q) # remove all volumes |
95 | ``` | 100 | ``` |
101 | |||
102 | ### SystemD config | ||
103 | Systemd is the process manager of choice on ubuntu. Once you have a ``docker`` service installed, you can add use the following steps to set up Shaarli to run on system start. | ||
104 | |||
105 | ```bash | ||
106 | systemctl enable /etc/systemd/system/docker.shaarli.service | ||
107 | systemctl start docker.shaarli | ||
108 | systemctl status docker.* | ||
109 | journalctl -f # inspect system log if needed | ||
110 | ``` | ||
111 | |||
112 | You will need sudo or a root terminal to perform some or all of the steps above. Here are the contents for the service file: | ||
113 | ``` | ||
114 | [Unit] | ||
115 | Description=Shaarli Bookmark Manager Container | ||
116 | After=docker.service | ||
117 | Requires=docker.service | ||
118 | |||
119 | |||
120 | [Service] | ||
121 | Restart=always | ||
122 | |||
123 | # Put any environment you want in here, like $host- or $domainname in this example | ||
124 | EnvironmentFile=/etc/sysconfig/box-environment | ||
125 | |||
126 | # It's just an example.. | ||
127 | ExecStart=/usr/bin/docker run \ | ||
128 | -p 28010:80 \ | ||
129 | --name ${hostname}-shaarli \ | ||
130 | --hostname shaarli.${domainname} \ | ||
131 | \ | ||
132 | -v /srv/docker-volumes-local/shaarli-data:/var/www/shaarli/data:rw \ | ||
133 | -v /etc/localtime:/etc/localtime:ro \ | ||
134 | \ | ||
135 | shaarli/shaarli:latest | ||
136 | |||
137 | ExecStop=/usr/bin/docker rm -f ${hostname}-shaarli | ||
138 | |||
139 | |||
140 | [Install] | ||
141 | WantedBy=multi-user.target | ||
142 | ``` | ||