]>
Commit | Line | Data |
---|---|---|
1 | A brief guide on getting starting using docker is given in [Docker 101](docker-101.md). | |
2 | To learn more about user data and how to keep it across versions, please see [Upgrade and Migration](../Upgrade-and-migration.md). | |
3 | ||
4 | ## Get and run a Shaarli image | |
5 | ||
6 | ### DockerHub repository | |
7 | The images can be found in the [`shaarli/shaarli`](https://hub.docker.com/r/shaarli/shaarli/) | |
8 | repository. | |
9 | ||
10 | ### Available image tags | |
11 | - `latest`: latest branch (tarball release) | |
12 | - `master`: master branch (tarball release) | |
13 | - `stable`: stable branch (tarball release) | |
14 | ||
15 | The `latest` and `master` images rely on: | |
16 | ||
17 | - [Alpine Linux](https://www.alpinelinux.org/) | |
18 | - [PHP7-FPM](http://php-fpm.org/) | |
19 | - [Nginx](http://nginx.org/) | |
20 | ||
21 | The `stable` image relies on: | |
22 | ||
23 | - [Debian 8 Jessie](https://hub.docker.com/_/debian/) | |
24 | - [PHP5-FPM](http://php-fpm.org/) | |
25 | - [Nginx](http://nginx.org/) | |
26 | ||
27 | Additional [Dockerfiles](https://github.com/shaarli/Shaarli/tree/master/docker) are provided for the `arm32v7` platform, relying on [Linuxserver.io Alpine armhf images](https://hub.docker.com/r/lsiobase/alpine.armhf/). These images must be built using [`docker build`](https://docs.docker.com/engine/reference/commandline/build/) on an `arm32v7` machine or using an emulator such as [qemu](https://resin.io/blog/building-arm-containers-on-any-x86-machine-even-dockerhub/). | |
28 | ||
29 | ### Download from DockerHub | |
30 | ```bash | |
31 | $ docker pull shaarli/shaarli | |
32 | latest: Pulling from shaarli/shaarli | |
33 | 32716d9fcddb: Pull complete | |
34 | 84899d045435: Pull complete | |
35 | 4b6ad7444763: Pull complete | |
36 | e0345ef7a3e0: Pull complete | |
37 | 5c1dd344094f: Pull complete | |
38 | 6422305a200b: Pull complete | |
39 | 7d63f861dbef: Pull complete | |
40 | 3eb97210645c: Pull complete | |
41 | 869319d746ff: Already exists | |
42 | 869319d746ff: Pulling fs layer | |
43 | 902b87aaaec9: Already exists | |
44 | Digest: sha256:f836b4627b958b3f83f59c332f22f02fcd495ace3056f2be2c4912bd8704cc98 | |
45 | Status: Downloaded newer image for shaarli/shaarli:latest | |
46 | ``` | |
47 | ||
48 | ### Create and start a new container from the image | |
49 | ```bash | |
50 | # map the host's :8000 port to the container's :80 port | |
51 | $ docker create -p 8000:80 shaarli/shaarli | |
52 | d40b7af693d678958adedfb88f87d6ea0237186c23de5c4102a55a8fcb499101 | |
53 | ||
54 | # launch the container in the background | |
55 | $ docker start d40b7af693d678958adedfb88f87d6ea0237186c23de5c4102a55a8fcb499101 | |
56 | d40b7af693d678958adedfb88f87d6ea0237186c23de5c4102a55a8fcb499101 | |
57 | ||
58 | # list active containers | |
59 | $ docker ps | |
60 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
61 | d40b7af693d6 shaarli/shaarli /usr/bin/supervisor 15 seconds ago Up 4 seconds 0.0.0.0:8000->80/tcp backstabbing_galileo | |
62 | ``` | |
63 | ||
64 | ### Stop and destroy a container | |
65 | ```bash | |
66 | $ docker stop backstabbing_galileo # those docker guys are really rude to physicists! | |
67 | backstabbing_galileo | |
68 | ||
69 | # check the container is stopped | |
70 | $ docker ps | |
71 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
72 | ||
73 | # list ALL containers | |
74 | $ docker ps -a | |
75 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
76 | d40b7af693d6 shaarli/shaarli /usr/bin/supervisor 5 minutes ago Exited (0) 48 seconds ago backstabbing_galileo | |
77 | ||
78 | # destroy the container | |
79 | $ docker rm backstabbing_galileo # let's put an end to these barbarian practices | |
80 | backstabbing_galileo | |
81 | ||
82 | $ docker ps -a | |
83 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
84 | ``` | |
85 | ||
86 | ### Automatic builds | |
87 | ||
88 | Docker users can start a personal instance from an [autobuild image](https://hub.docker.com/r/shaarli/shaarli/). For example to start a temporary Shaarli at ``localhost:8000``, and keep session data (config, storage): | |
89 | ``` | |
90 | MY_SHAARLI_VOLUME=$(cd /path/to/shaarli/data/ && pwd -P) | |
91 | docker run -ti --rm \ | |
92 | -p 8000:80 \ | |
93 | -v $MY_SHAARLI_VOLUME:/var/www/shaarli/data \ | |
94 | shaarli/shaarli | |
95 | ``` |