]>
Commit | Line | Data |
---|---|---|
1 | <!DOCTYPE html> | |
2 | <html> | |
3 | <head> | |
4 | <meta charset="utf-8"> | |
5 | <meta name="generator" content="pandoc"> | |
6 | <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> | |
7 | <title>Shaarli – Docker</title> | |
8 | <style type="text/css">code{white-space: pre;}</style> | |
9 | <style type="text/css"> | |
10 | div.sourceCode { overflow-x: auto; } | |
11 | table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode { | |
12 | margin: 0; padding: 0; vertical-align: baseline; border: none; } | |
13 | table.sourceCode { width: 100%; line-height: 100%; } | |
14 | td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; } | |
15 | td.sourceCode { padding-left: 5px; } | |
16 | code > span.kw { color: #007020; font-weight: bold; } /* Keyword */ | |
17 | code > span.dt { color: #902000; } /* DataType */ | |
18 | code > span.dv { color: #40a070; } /* DecVal */ | |
19 | code > span.bn { color: #40a070; } /* BaseN */ | |
20 | code > span.fl { color: #40a070; } /* Float */ | |
21 | code > span.ch { color: #4070a0; } /* Char */ | |
22 | code > span.st { color: #4070a0; } /* String */ | |
23 | code > span.co { color: #60a0b0; font-style: italic; } /* Comment */ | |
24 | code > span.ot { color: #007020; } /* Other */ | |
25 | code > span.al { color: #ff0000; font-weight: bold; } /* Alert */ | |
26 | code > span.fu { color: #06287e; } /* Function */ | |
27 | code > span.er { color: #ff0000; font-weight: bold; } /* Error */ | |
28 | code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ | |
29 | code > span.cn { color: #880000; } /* Constant */ | |
30 | code > span.sc { color: #4070a0; } /* SpecialChar */ | |
31 | code > span.vs { color: #4070a0; } /* VerbatimString */ | |
32 | code > span.ss { color: #bb6688; } /* SpecialString */ | |
33 | code > span.im { } /* Import */ | |
34 | code > span.va { color: #19177c; } /* Variable */ | |
35 | code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ | |
36 | code > span.op { color: #666666; } /* Operator */ | |
37 | code > span.bu { } /* BuiltIn */ | |
38 | code > span.ex { } /* Extension */ | |
39 | code > span.pp { color: #bc7a00; } /* Preprocessor */ | |
40 | code > span.at { color: #7d9029; } /* Attribute */ | |
41 | code > span.do { color: #ba2121; font-style: italic; } /* Documentation */ | |
42 | code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ | |
43 | code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ | |
44 | code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ | |
45 | </style> | |
46 | <link rel="stylesheet" href="github-markdown.css"> | |
47 | <!--[if lt IE 9]> | |
48 | <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script> | |
49 | <![endif]--> | |
50 | </head> | |
51 | <body> | |
52 | <div id="local-sidebar"> | |
53 | <ul> | |
54 | <li><a href="Home.html">Home</a></li> | |
55 | <li>Setup | |
56 | <ul> | |
57 | <li><a href="Download-and-Installation.html">Download and Installation</a></li> | |
58 | <li><a href="Upgrade-and-migration.html">Upgrade and migration</a></li> | |
59 | <li><a href="Server-requirements.html">Server requirements</a></li> | |
60 | <li><a href="Server-configuration.html">Server configuration</a></li> | |
61 | <li><a href="Server-security.html">Server security</a></li> | |
62 | <li><a href="Shaarli-configuration.html">Shaarli configuration</a></li> | |
63 | <li><a href="Plugins.html">Plugins</a></li> | |
64 | </ul></li> | |
65 | <li><a href="Docker.html">Docker</a></li> | |
66 | <li><a href="Usage.html">Usage</a> | |
67 | <ul> | |
68 | <li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li> | |
69 | <li><a href="Browsing-and-Searching.html">Browsing and Searching</a></li> | |
70 | <li><a href="Firefox-share.html">Firefox share</a></li> | |
71 | <li><a href="RSS-feeds.html">RSS feeds</a></li> | |
72 | </ul></li> | |
73 | <li>How To | |
74 | <ul> | |
75 | <li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li> | |
76 | <li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li> | |
77 | <li><a href="Create-and-serve-multiple-Shaarlis-(farm).html">Create and serve multiple Shaarlis (farm)</a></li> | |
78 | <li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li> | |
79 | <li><a href="Datastore-hacks.html">Datastore hacks</a></li> | |
80 | </ul></li> | |
81 | <li><a href="Troubleshooting.html">Troubleshooting</a></li> | |
82 | <li><a href="Development.html">Development</a> | |
83 | <ul> | |
84 | <li><a href="GnuPG-signature.html">GnuPG signature</a></li> | |
85 | <li><a href="Coding-guidelines.html">Coding guidelines</a></li> | |
86 | <li><a href="Directory-structure.html">Directory structure</a></li> | |
87 | <li><a href="3rd-party-libraries.html">3rd party libraries</a></li> | |
88 | <li><a href="Plugin-System.html">Plugin System</a></li> | |
89 | <li><a href="Release-Shaarli.html">Release Shaarli</a></li> | |
90 | <li><a href="Security.html">Security</a></li> | |
91 | <li><a href="Static-analysis.html">Static analysis</a></li> | |
92 | <li><a href="Theming.html">Theming</a></li> | |
93 | <li><a href="Unit-tests.html">Unit tests</a></li> | |
94 | </ul></li> | |
95 | <li>About | |
96 | <ul> | |
97 | <li><a href="FAQ.html">FAQ</a></li> | |
98 | <li><a href="Community-&-Related-software.html">Community & Related software</a></li> | |
99 | </ul></li> | |
100 | </ul> | |
101 | </div> | |
102 | <h1 id="docker">Docker</h1> | |
103 | <ul> | |
104 | <li><a href="#docker-usage">Docker usage</a><a href=".html"></a></li> | |
105 | <li><a href="#get-and-run-a-shaarli-image">Get and run a Shaarli image</a><a href=".html"></a></li> | |
106 | <li><a href="#resources">Resources</a><a href=".html"></a></li> | |
107 | </ul> | |
108 | <h2 id="docker-usage">Docker usage</h2> | |
109 | <h3 id="basics">Basics</h3> | |
110 | <p>Install <a href="https://www.docker.com/">Docker</a>, by following the instructions relevant<a href=".html"></a><br /> | |
111 | to your OS / distribution, and start the service.</p> | |
112 | <h4 id="search-an-image-on-dockerhub">Search an image on <a href="https://hub.docker.com/">DockerHub</a><a href=".html"></a></h4> | |
113 | <div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="ex">docker</span> search debian | |
114 | ||
115 | <span class="ex">NAME</span> DESCRIPTION STARS OFFICIAL AUTOMATED | |
116 | <span class="ex">ubuntu</span> Ubuntu is a Debian-based Linux operating s... 2065 [OK][](.html) | |
117 | <span class="ex">debian</span> Debian is a Linux distribution that<span class="st">'s comp... 603 [OK][](.html)</span> | |
118 | <span class="st">google/debian 47 [OK][](.html)</span></code></pre></div> | |
119 | <h4 id="show-available-tags-for-a-repository">Show available tags for a repository</h4> | |
120 | <div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="ex">curl</span> https://index.docker.io/v1/repositories/debian/tags <span class="kw">|</span> <span class="ex">python</span> -m json.tool | |
121 | ||
122 | <span class="ex">%</span> Total % Received % Xferd Average Speed Time Time Time Current | |
123 | <span class="ex">Dload</span> Upload Total Spent Left Speed | |
124 | <span class="ex">100</span> 1283 0 1283 0 0 433 0 --:--:-- 0:00:02 --:--:-- 433</code></pre></div> | |
125 | <p>Sample output:</p> | |
126 | <div class="sourceCode"><pre class="sourceCode json"><code class="sourceCode json"><span class="ot">[[]</span><span class="er">(.html)</span> | |
127 | <span class="fu">{</span> | |
128 | <span class="dt">"layer"</span><span class="fu">:</span> <span class="st">"85a02782"</span><span class="fu">,</span> | |
129 | <span class="dt">"name"</span><span class="fu">:</span> <span class="st">"stretch"</span> | |
130 | <span class="fu">}</span><span class="ot">,</span> | |
131 | <span class="fu">{</span> | |
132 | <span class="dt">"layer"</span><span class="fu">:</span> <span class="st">"59abecbc"</span><span class="fu">,</span> | |
133 | <span class="dt">"name"</span><span class="fu">:</span> <span class="st">"testing"</span> | |
134 | <span class="fu">}</span><span class="ot">,</span> | |
135 | <span class="fu">{</span> | |
136 | <span class="dt">"layer"</span><span class="fu">:</span> <span class="st">"bf0fd686"</span><span class="fu">,</span> | |
137 | <span class="dt">"name"</span><span class="fu">:</span> <span class="st">"unstable"</span> | |
138 | <span class="fu">}</span><span class="ot">,</span> | |
139 | <span class="fu">{</span> | |
140 | <span class="dt">"layer"</span><span class="fu">:</span> <span class="st">"60c52dbe"</span><span class="fu">,</span> | |
141 | <span class="dt">"name"</span><span class="fu">:</span> <span class="st">"wheezy"</span> | |
142 | <span class="fu">}</span><span class="ot">,</span> | |
143 | <span class="fu">{</span> | |
144 | <span class="dt">"layer"</span><span class="fu">:</span> <span class="st">"c5b806fe"</span><span class="fu">,</span> | |
145 | <span class="dt">"name"</span><span class="fu">:</span> <span class="st">"wheezy-backports"</span> | |
146 | <span class="fu">}</span> | |
147 | <span class="ot">]</span></code></pre></div> | |
148 | <h4 id="pull-an-image-from-dockerhub">Pull an image from DockerHub</h4> | |
149 | <div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="ex">docker</span> pull repository[:tag][](.html) | |
150 | ||
151 | $ <span class="ex">docker</span> pull debian:wheezy | |
152 | <span class="ex">wheezy</span>: Pulling from debian | |
153 | <span class="ex">4c8cbfd2973e</span>: Pull complete | |
154 | <span class="ex">60c52dbe9d91</span>: Pull complete | |
155 | <span class="ex">Digest</span>: sha256:c584131da2ac1948aa3e66468a4424b6aea2f33acba7cec0b631bdb56254c4fe | |
156 | <span class="ex">Status</span>: Downloaded newer image for debian:wheezy</code></pre></div> | |
157 | <h2 id="get-and-run-a-shaarli-image">Get and run a Shaarli image</h2> | |
158 | <h3 id="dockerhub-repository">DockerHub repository</h3> | |
159 | <p>The images can be found in the <a href="https://hub.docker.com/r/shaarli/shaarli/"><code>shaarli/shaarli</code></a><a href=".html"></a><br /> | |
160 | repository.</p> | |
161 | <h3 id="available-image-tags">Available image tags</h3> | |
162 | <ul> | |
163 | <li><code>latest</code>: master branch (tarball release)</li> | |
164 | <li><code>stable</code>: stable branch (tarball release)</li> | |
165 | <li><code>dev</code>: master branch (Git clone)</li> | |
166 | </ul> | |
167 | <p>All images rely on:</p> | |
168 | <ul> | |
169 | <li><a href="https://hub.docker.com/_/debian/">Debian 8 Jessie</a><a href=".html"></a></li> | |
170 | <li><a href="http://php-fpm.org/">PHP5-FPM</a><a href=".html"></a></li> | |
171 | <li><a href="http://nginx.org/">Nginx</a><a href=".html"></a></li> | |
172 | </ul> | |
173 | <h3 id="download-from-dockerhub">Download from DockerHub</h3> | |
174 | <div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="ex">docker</span> pull shaarli/shaarli | |
175 | <span class="ex">latest</span>: Pulling from shaarli/shaarli | |
176 | <span class="ex">32716d9fcddb</span>: Pull complete | |
177 | <span class="ex">84899d045435</span>: Pull complete | |
178 | <span class="ex">4b6ad7444763</span>: Pull complete | |
179 | <span class="ex">e0345ef7a3e0</span>: Pull complete | |
180 | <span class="ex">5c1dd344094f</span>: Pull complete | |
181 | <span class="ex">6422305a200b</span>: Pull complete | |
182 | <span class="ex">7d63f861dbef</span>: Pull complete | |
183 | <span class="ex">3eb97210645c</span>: Pull complete | |
184 | <span class="ex">869319d746ff</span>: Already exists | |
185 | <span class="ex">869319d746ff</span>: Pulling fs layer | |
186 | <span class="ex">902b87aaaec9</span>: Already exists | |
187 | <span class="ex">Digest</span>: sha256:f836b4627b958b3f83f59c332f22f02fcd495ace3056f2be2c4912bd8704cc98 | |
188 | <span class="ex">Status</span>: Downloaded newer image for shaarli/shaarli:latest</code></pre></div> | |
189 | <h3 id="create-and-start-a-new-container-from-the-image">Create and start a new container from the image</h3> | |
190 | <div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="co"># map the host's :8000 port to the container's :80 port</span> | |
191 | $ <span class="ex">docker</span> create -p 8000:80 shaarli/shaarli | |
192 | <span class="ex">d40b7af693d678958adedfb88f87d6ea0237186c23de5c4102a55a8fcb499101</span> | |
193 | ||
194 | <span class="co"># launch the container in the background</span> | |
195 | $ <span class="ex">docker</span> start d40b7af693d678958adedfb88f87d6ea0237186c23de5c4102a55a8fcb499101 | |
196 | <span class="ex">d40b7af693d678958adedfb88f87d6ea0237186c23de5c4102a55a8fcb499101</span> | |
197 | ||
198 | <span class="co"># list active containers</span> | |
199 | $ <span class="ex">docker</span> ps | |
200 | <span class="ex">CONTAINER</span> ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
201 | <span class="ex">d40b7af693d6</span> shaarli/shaarli /usr/bin/supervisor 15 seconds ago Up 4 seconds 0.0.0.0:8000-<span class="op">></span>80/tcp backstabbing_galileo</code></pre></div> | |
202 | <h3 id="stop-and-destroy-a-container">Stop and destroy a container</h3> | |
203 | <div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="ex">docker</span> stop backstabbing_galileo <span class="co"># those docker guys are really rude to physicists!</span> | |
204 | <span class="ex">backstabbing_galileo</span> | |
205 | ||
206 | <span class="co"># check the container is stopped</span> | |
207 | $ <span class="ex">docker</span> ps | |
208 | <span class="ex">CONTAINER</span> ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
209 | ||
210 | <span class="co"># list ALL containers</span> | |
211 | $ <span class="ex">docker</span> ps -a | |
212 | <span class="ex">CONTAINER</span> ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
213 | <span class="ex">d40b7af693d6</span> shaarli/shaarli /usr/bin/supervisor 5 minutes ago Exited (0) <span class="ex">48</span> seconds ago backstabbing_galileo | |
214 | ||
215 | <span class="co"># destroy the container</span> | |
216 | $ <span class="ex">docker</span> rm backstabbing_galileo <span class="co"># let's put an end to these barbarian practices</span> | |
217 | <span class="ex">backstabbing_galileo</span> | |
218 | ||
219 | $ <span class="ex">docker</span> ps -a | |
220 | <span class="ex">CONTAINER</span> ID IMAGE COMMAND CREATED STATUS PORTS NAMES</code></pre></div> | |
221 | <h2 id="resources">Resources</h2> | |
222 | <h3 id="docker-1">Docker</h3> | |
223 | <ul> | |
224 | <li><a href="http://blog.thoward37.me/articles/where-are-docker-images-stored/">Where are Docker images stored?</a><a href=".html"></a></li> | |
225 | <li><a href="https://docs.docker.com/reference/builder/">Dockerfile reference</a><a href=".html"></a></li> | |
226 | <li><a href="https://docs.docker.com/articles/dockerfile_best-practices/">Dockerfile best practices</a><a href=".html"></a></li> | |
227 | <li><a href="https://docs.docker.com/userguide/dockervolumes/">Volumes</a><a href=".html"></a></li> | |
228 | </ul> | |
229 | <h3 id="dockerhub">DockerHub</h3> | |
230 | <ul> | |
231 | <li><a href="https://docs.docker.com/userguide/dockerrepos/">Repositories</a><a href=".html"></a></li> | |
232 | <li><a href="https://docs.docker.com/docker-hub/orgs/">Teams and organizations</a><a href=".html"></a></li> | |
233 | <li><a href="https://docs.docker.com/docker-hub/github/">GitHub automated build</a><a href=".html"></a></li> | |
234 | </ul> | |
235 | <h3 id="service-management">Service management</h3> | |
236 | <ul> | |
237 | <li><a href="https://docs.docker.com/articles/using_supervisord/">Using supervisord</a><a href=".html"></a></li> | |
238 | <li><a href="http://nginx.org/en/docs/ngx_core_module.html#daemon">Nginx in the foreground</a><a href=".html"></a></li> | |
239 | <li><a href="http://supervisord.org/">supervisord</a><a href=".html"></a></li> | |
240 | </ul> | |
241 | </body> | |
242 | </html> |