diff options
author | ArthurHoaro <arthur@hoa.ro> | 2016-10-12 13:58:35 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-10-12 13:58:35 +0200 |
commit | bc22c9a0acb095970e9494cbe8954f0612e05dc0 (patch) | |
tree | 4e3a94b7469f5b2e3eaf946756235730429bf9d4 /doc/Docker.md | |
parent | 890afc32f744859d11b97eb26ed5c030af9b4145 (diff) | |
parent | ebd67c6e1b40aebdd3a52285ce9ff9412b2a3038 (diff) | |
download | Shaarli-bc22c9a0acb095970e9494cbe8954f0612e05dc0.tar.gz Shaarli-bc22c9a0acb095970e9494cbe8954f0612e05dc0.tar.zst Shaarli-bc22c9a0acb095970e9494cbe8954f0612e05dc0.zip |
Merge tag 'v0.7.0' of github.com:shaarli/Shaarli into stable
Release v0.7.0
Diffstat (limited to 'doc/Docker.md')
-rw-r--r-- | doc/Docker.md | 157 |
1 files changed, 157 insertions, 0 deletions
diff --git a/doc/Docker.md b/doc/Docker.md new file mode 100644 index 00000000..1faa7904 --- /dev/null +++ b/doc/Docker.md | |||
@@ -0,0 +1,157 @@ | |||
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 | ||
8 | Install [Docker](https://www.docker.com/), by following the instructions relevant[](.html) | ||
9 | to 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 | |||
16 | NAME DESCRIPTION STARS OFFICIAL AUTOMATED | ||
17 | ubuntu Ubuntu is a Debian-based Linux operating s... 2065 [OK][](.html) | ||
18 | debian Debian is a Linux distribution that's comp... 603 [OK][](.html) | ||
19 | google/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 | ||
27 | Dload Upload Total Spent Left Speed | ||
28 | 100 1283 0 1283 0 0 433 0 --:--:-- 0:00:02 --:--:-- 433 | ||
29 | ``` | ||
30 | |||
31 | Sample 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 | ||
63 | wheezy: Pulling from debian | ||
64 | 4c8cbfd2973e: Pull complete | ||
65 | 60c52dbe9d91: Pull complete | ||
66 | Digest: sha256:c584131da2ac1948aa3e66468a4424b6aea2f33acba7cec0b631bdb56254c4fe | ||
67 | Status: Downloaded newer image for debian:wheezy | ||
68 | ``` | ||
69 | |||
70 | ## Get and run a Shaarli image | ||
71 | ### DockerHub repository | ||
72 | The images can be found in the [`shaarli/shaarli`](https://hub.docker.com/r/shaarli/shaarli/)[](.html) | ||
73 | repository. | ||
74 | |||
75 | ### Available image tags | ||
76 | - `latest`: master branch (tarball release) | ||
77 | - `stable`: stable branch (tarball release) | ||
78 | - `dev`: master branch (Git clone) | ||
79 | |||
80 | All 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 | ||
88 | latest: Pulling from shaarli/shaarli | ||
89 | 32716d9fcddb: Pull complete | ||
90 | 84899d045435: Pull complete | ||
91 | 4b6ad7444763: Pull complete | ||
92 | e0345ef7a3e0: Pull complete | ||
93 | 5c1dd344094f: Pull complete | ||
94 | 6422305a200b: Pull complete | ||
95 | 7d63f861dbef: Pull complete | ||
96 | 3eb97210645c: Pull complete | ||
97 | 869319d746ff: Already exists | ||
98 | 869319d746ff: Pulling fs layer | ||
99 | 902b87aaaec9: Already exists | ||
100 | Digest: sha256:f836b4627b958b3f83f59c332f22f02fcd495ace3056f2be2c4912bd8704cc98 | ||
101 | Status: 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 | ||
108 | d40b7af693d678958adedfb88f87d6ea0237186c23de5c4102a55a8fcb499101 | ||
109 | |||
110 | # launch the container in the background | ||
111 | $ docker start d40b7af693d678958adedfb88f87d6ea0237186c23de5c4102a55a8fcb499101 | ||
112 | d40b7af693d678958adedfb88f87d6ea0237186c23de5c4102a55a8fcb499101 | ||
113 | |||
114 | # list active containers | ||
115 | $ docker ps | ||
116 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | ||
117 | d40b7af693d6 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! | ||
123 | backstabbing_galileo | ||
124 | |||
125 | # check the container is stopped | ||
126 | $ docker ps | ||
127 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | ||
128 | |||
129 | # list ALL containers | ||
130 | $ docker ps -a | ||
131 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | ||
132 | d40b7af693d6 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 | ||
136 | backstabbing_galileo | ||
137 | |||
138 | $ docker ps -a | ||
139 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | ||
140 | ``` | ||
141 | |||
142 | ## Resources | ||
143 | ### Docker | ||
144 | - [Where are Docker images stored?](http://blog.thoward37.me/articles/where-are-docker-images-stored/)[](.html) | ||
145 | - [Dockerfile reference](https://docs.docker.com/reference/builder/)[](.html) | ||
146 | - [Dockerfile best practices](https://docs.docker.com/articles/dockerfile_best-practices/)[](.html) | ||
147 | - [Volumes](https://docs.docker.com/userguide/dockervolumes/)[](.html) | ||
148 | |||
149 | ### DockerHub | ||
150 | - [Repositories](https://docs.docker.com/userguide/dockerrepos/)[](.html) | ||
151 | - [Teams and organizations](https://docs.docker.com/docker-hub/orgs/)[](.html) | ||
152 | - [GitHub automated build](https://docs.docker.com/docker-hub/github/)[](.html) | ||
153 | |||
154 | ### Service management | ||
155 | - [Using supervisord](https://docs.docker.com/articles/using_supervisord/)[](.html) | ||
156 | - [Nginx in the foreground](http://nginx.org/en/docs/ngx_core_module.html#daemon)[](.html) | ||
157 | - [supervisord](http://supervisord.org/)[](.html) | ||