2 Install [Docker](https://www.docker.com/), by following the instructions relevant
3 to your OS / distribution, and start the service.
5 ### Search an image on [DockerHub](https://hub.docker.com/)
10 NAME DESCRIPTION STARS OFFICIAL AUTOMATED
11 ubuntu Ubuntu is a Debian-based Linux operating s... 2065 [OK]
12 debian Debian is a Linux distribution that's comp... 603 [OK]
16 ### Show available tags for a repository
18 $ curl https://index.docker.io/v1/repositories/debian/tags | python -m json.tool
20 % Total % Received % Xferd Average Speed Time Time Time Current
21 Dload Upload Total Spent Left Speed
22 100 1283 0 1283 0 0 433 0 --:--:-- 0:00:02 --:--:-- 433
46 "name": "wheezy-backports"
52 ### Pull an image from DockerHub
54 $ docker pull repository[:tag]
56 $ docker pull debian:wheezy
57 wheezy: Pulling from debian
58 4c8cbfd2973e: Pull complete
59 60c52dbe9d91: Pull complete
60 Digest: sha256:c584131da2ac1948aa3e66468a4424b6aea2f33acba7cec0b631bdb56254c4fe
61 Status: Downloaded newer image for debian:wheezy
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.
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.
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``.
71 Stopped containers are not destroyed, unless you specify ``--rm``. To view all created, running and stopped containers, enter:
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.
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:
81 $ docker exec -ti <container-name-or-id> bash
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.
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``.
87 You can view the console output of the main container process too:
89 $ docker logs -f <container-name-or-id>
93 Trying out different images can fill some gigabytes of disk quickly. Besides images, the docker volumes usually take up most disk space.
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:
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
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.
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
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:
115 Description=Shaarli Bookmark Manager Container
117 Requires=docker.service
123 # Put any environment you want in an included file, like $host- or $domainname in this example
124 EnvironmentFile=/etc/sysconfig/box-environment
126 # It's just an example..
127 ExecStart=/usr/bin/docker run \
129 --name ${hostname}-shaarli \
130 --hostname shaarli.${domainname} \
131 -v /srv/docker-volumes-local/shaarli-data:/var/www/shaarli/data:rw \
132 -v /etc/localtime:/etc/localtime:ro \
133 shaarli/shaarli:latest
135 ExecStop=/usr/bin/docker rm -f ${hostname}-shaarli
139 WantedBy=multi-user.target