diff options
Diffstat (limited to 'doc/md/docker/docker-101.md')
-rw-r--r-- | doc/md/docker/docker-101.md | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/doc/md/docker/docker-101.md b/doc/md/docker/docker-101.md index 35a68774..a9c00b85 100644 --- a/doc/md/docker/docker-101.md +++ b/doc/md/docker/docker-101.md | |||
@@ -61,26 +61,26 @@ Digest: sha256:c584131da2ac1948aa3e66468a4424b6aea2f33acba7cec0b631bdb56254c4fe | |||
61 | Status: Downloaded newer image for debian:wheezy | 61 | Status: Downloaded newer image for debian:wheezy |
62 | ``` | 62 | ``` |
63 | 63 | ||
64 | Docker re-uses layers already downloaded. Iow. if you have images based only Alpine or some Ubuntu version for example, those can share disk space. | 64 | Docker re-uses layers already downloaded. In other words if you have images based on Alpine or some Ubuntu version for example, those can share disk space. |
65 | 65 | ||
66 | ### Start a container | 66 | ### Start a container |
67 | A container is an instance created from an image, that can be run and that keeps running until its main process exits. Or until the user stops the container. | 67 | A container is an instance created from an image, that can be run and that keeps running until its main process exits. Or until the user stops the container. |
68 | 68 | ||
69 | The simplest way to start a container from image is ``docker run``. It also pulls the image for you if it is not locally available. For more advanced use, refer to ``docker create``. | 69 | The simplest way to start a container from image is ``docker run``. It also pulls the image for you if it is not locally available. For more advanced use, refer to ``docker create``. |
70 | 70 | ||
71 | Note that stopped containers are not destroyed, unless you specify ``--rm``. To view all created, running and stopped containers, enter: | 71 | Stopped containers are not destroyed, unless you specify ``--rm``. To view all created, running and stopped containers, enter: |
72 | ```bash | 72 | ```bash |
73 | $ docker ps -a | 73 | $ docker ps -a |
74 | ``` | 74 | ``` |
75 | 75 | ||
76 | Some containers may be designed or configured to be restarted, others are not. Note that both network ports and volumes of a container are created on start, and not editable later. | 76 | Some containers may be designed or configured to be restarted, others are not. Also remember both network ports and volumes of a container are created on start, and not editable later. |
77 | 77 | ||
78 | ### Access a running container | 78 | ### Access a running container |
79 | A running container is accessible using ``docker exec``, or ``docker copy``. You can use ``exec`` to start a root shell in the Shaarli container: | 79 | A running container is accessible using ``docker exec``, or ``docker copy``. You can use ``exec`` to start a root shell in the Shaarli container: |
80 | ```bash | 80 | ```bash |
81 | $ docker exec -ti <container-name-or-id> bash | 81 | $ docker exec -ti <container-name-or-id> bash |
82 | ``` | 82 | ``` |
83 | Note the names and ID's of containers are list in ``docker ps``. You an even type only one or two letters of the ID, given they are unique. | 83 | Note the names and ID's of containers are listed in ``docker ps``. You can even type only one or two letters of the ID, given they are unique. |
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 | ||
@@ -92,15 +92,15 @@ $ docker logs -f <container-name-or-id> | |||
92 | ### Docker disk use | 92 | ### Docker disk use |
93 | 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. |
94 | 94 | ||
95 | If you care only about trying out docker and not about what is running or saved, the following commands should help you out quickly: | 95 | If you care only about trying out docker and not about what is running or saved, the following commands should help you out quickly if you run low on disk space: |
96 | 96 | ||
97 | ```bash | 97 | ```bash |
98 | $ 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 |
99 | $ docker volume rm $(docker volume ls -q) # remove all volumes | 99 | $ docker volume rm $(docker volume ls -q) # remove all volumes |
100 | ``` | 100 | ``` |
101 | 101 | ||
102 | ### SystemD config | 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. | 103 | Systemd is the process manager of choice on Debian-based distributions. Once you have a ``docker`` service installed, you can use the following steps to set up Shaarli to run on system start. |
104 | 104 | ||
105 | ```bash | 105 | ```bash |
106 | systemctl enable /etc/systemd/system/docker.shaarli.service | 106 | systemctl enable /etc/systemd/system/docker.shaarli.service |
@@ -120,7 +120,7 @@ Requires=docker.service | |||
120 | [Service] | 120 | [Service] |
121 | Restart=always | 121 | Restart=always |
122 | 122 | ||
123 | # Put any environment you want in here, like $host- or $domainname in this example | 123 | # Put any environment you want in an included file, like $host- or $domainname in this example |
124 | EnvironmentFile=/etc/sysconfig/box-environment | 124 | EnvironmentFile=/etc/sysconfig/box-environment |
125 | 125 | ||
126 | # It's just an example.. | 126 | # It's just an example.. |
@@ -128,11 +128,9 @@ ExecStart=/usr/bin/docker run \ | |||
128 | -p 28010:80 \ | 128 | -p 28010:80 \ |
129 | --name ${hostname}-shaarli \ | 129 | --name ${hostname}-shaarli \ |
130 | --hostname shaarli.${domainname} \ | 130 | --hostname shaarli.${domainname} \ |
131 | \ | ||
132 | -v /srv/docker-volumes-local/shaarli-data:/var/www/shaarli/data:rw \ | 131 | -v /srv/docker-volumes-local/shaarli-data:/var/www/shaarli/data:rw \ |
133 | -v /etc/localtime:/etc/localtime:ro \ | 132 | -v /etc/localtime:/etc/localtime:ro \ |
134 | \ | 133 | shaarli/shaarli:latest |
135 | shaarli/shaarli:latest | ||
136 | 134 | ||
137 | ExecStop=/usr/bin/docker rm -f ${hostname}-shaarli | 135 | ExecStop=/usr/bin/docker rm -f ${hostname}-shaarli |
138 | 136 | ||