]> git.immae.eu Git - github/shaarli/Shaarli.git/blame - doc/Docker.md
Merge pull request #896 from ArthurHoaro/hotfix/firefox-social-subdir
[github/shaarli/Shaarli.git] / doc / Docker.md
CommitLineData
5409ade2
A
1#Docker
2- [Docker usage](#docker-usage)[](.html)
3- [Get and run a Shaarli image](#get-and-run-a-shaarli-image)[](.html)
4- [Resources](#resources)[](.html)
5
6## Docker usage
7### Basics
8Install [Docker](https://www.docker.com/), by following the instructions relevant[](.html)
9to your OS / distribution, and start the service.
10
11#### Search an image on [DockerHub](https://hub.docker.com/)[](.html)
12
13```bash
14$ docker search debian
15
16NAME DESCRIPTION STARS OFFICIAL AUTOMATED
17ubuntu Ubuntu is a Debian-based Linux operating s... 2065 [OK][](.html)
18debian Debian is a Linux distribution that's comp... 603 [OK][](.html)
19google/debian 47 [OK][](.html)
20```
21
22#### Show available tags for a repository
23```bash
24$ curl https://index.docker.io/v1/repositories/debian/tags | python -m json.tool
25
26% Total % Received % Xferd Average Speed Time Time Time Current
27Dload Upload Total Spent Left Speed
28100 1283 0 1283 0 0 433 0 --:--:-- 0:00:02 --:--:-- 433
29```
30
31Sample output:
32```json
33[[](.html)
34 {
35 "layer": "85a02782",
36 "name": "stretch"
37 },
38 {
39 "layer": "59abecbc",
40 "name": "testing"
41 },
42 {
43 "layer": "bf0fd686",
44 "name": "unstable"
45 },
46 {
47 "layer": "60c52dbe",
48 "name": "wheezy"
49 },
50 {
51 "layer": "c5b806fe",
52 "name": "wheezy-backports"
53 }
54]
55
56```
57
58#### Pull an image from DockerHub
59```bash
60$ docker pull repository[:tag][](.html)
61
62$ docker pull debian:wheezy
63wheezy: Pulling from debian
644c8cbfd2973e: Pull complete
6560c52dbe9d91: Pull complete
66Digest: sha256:c584131da2ac1948aa3e66468a4424b6aea2f33acba7cec0b631bdb56254c4fe
67Status: Downloaded newer image for debian:wheezy
68```
69
70## Get and run a Shaarli image
71### DockerHub repository
72The images can be found in the [`shaarli/shaarli`](https://hub.docker.com/r/shaarli/shaarli/)[](.html)
73repository.
74
75### Available image tags
76- `latest`: master branch (tarball release)
77- `stable`: stable branch (tarball release)
78- `dev`: master branch (Git clone)
79
80All images rely on:
81- [Debian 8 Jessie](https://hub.docker.com/_/debian/)[](.html)
82- [PHP5-FPM](http://php-fpm.org/)[](.html)
83- [Nginx](http://nginx.org/)[](.html)
84
85### Download from DockerHub
86```bash
87$ docker pull shaarli/shaarli
88latest: Pulling from shaarli/shaarli
8932716d9fcddb: Pull complete
9084899d045435: Pull complete
914b6ad7444763: Pull complete
92e0345ef7a3e0: Pull complete
935c1dd344094f: Pull complete
946422305a200b: Pull complete
957d63f861dbef: Pull complete
963eb97210645c: Pull complete
97869319d746ff: Already exists
98869319d746ff: Pulling fs layer
99902b87aaaec9: Already exists
100Digest: sha256:f836b4627b958b3f83f59c332f22f02fcd495ace3056f2be2c4912bd8704cc98
101Status: Downloaded newer image for shaarli/shaarli:latest
102```
103
104### Create and start a new container from the image
105```bash
106# map the host's :8000 port to the container's :80 port
107$ docker create -p 8000:80 shaarli/shaarli
108d40b7af693d678958adedfb88f87d6ea0237186c23de5c4102a55a8fcb499101
109
110# launch the container in the background
111$ docker start d40b7af693d678958adedfb88f87d6ea0237186c23de5c4102a55a8fcb499101
112d40b7af693d678958adedfb88f87d6ea0237186c23de5c4102a55a8fcb499101
113
114# list active containers
115$ docker ps
116CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
117d40b7af693d6 shaarli/shaarli /usr/bin/supervisor 15 seconds ago Up 4 seconds 0.0.0.0:8000->80/tcp backstabbing_galileo
118```
119
120### Stop and destroy a container
121```bash
122$ docker stop backstabbing_galileo # those docker guys are really rude to physicists!
123backstabbing_galileo
124
125# check the container is stopped
126$ docker ps
127CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
128
129# list ALL containers
130$ docker ps -a
131CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
132d40b7af693d6 shaarli/shaarli /usr/bin/supervisor 5 minutes ago Exited (0) 48 seconds ago backstabbing_galileo
133
134# destroy the container
135$ docker rm backstabbing_galileo # let's put an end to these barbarian practices
136backstabbing_galileo
137
138$ docker ps -a
139CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
140```
141
142## Resources
143### Docker
b230bf20 144- [Interactive Docker training portal](https://www.katacoda.com/courses/docker/) on [Katakoda](https://www.katacoda.com/)[](.html)
5409ade2
A
145- [Where are Docker images stored?](http://blog.thoward37.me/articles/where-are-docker-images-stored/)[](.html)
146- [Dockerfile reference](https://docs.docker.com/reference/builder/)[](.html)
147- [Dockerfile best practices](https://docs.docker.com/articles/dockerfile_best-practices/)[](.html)
148- [Volumes](https://docs.docker.com/userguide/dockervolumes/)[](.html)
149
150### DockerHub
151- [Repositories](https://docs.docker.com/userguide/dockerrepos/)[](.html)
152- [Teams and organizations](https://docs.docker.com/docker-hub/orgs/)[](.html)
153- [GitHub automated build](https://docs.docker.com/docker-hub/github/)[](.html)
154
155### Service management
156- [Using supervisord](https://docs.docker.com/articles/using_supervisord/)[](.html)
157- [Nginx in the foreground](http://nginx.org/en/docs/ngx_core_module.html#daemon)[](.html)
158- [supervisord](http://supervisord.org/)[](.html)