blob: ea43d208f3d68b9ca8ab8edec37310ede72e2e8b [file] [log] [blame]
Michael Kutý17649402016-03-19 23:57:43 +01001
2======
3Docker
4======
5
6Docker is a platform for developers and sysadmins to develop, ship, and run applications. Docker lets you quickly assemble applications from components and eliminates the friction that can come when shipping code. Docker lets you get your code tested and deployed into production as fast as possible.
7
8Docker is supported on the following systems:
9
10* Debian 8.0 Jessie (64-bit)
11* Ubuntu Trusty 14.04 (LTS) (64-bit)
12* Ubuntu Precise 12.04 (LTS) (64-bit)
13* Ubuntu Raring 13.04 and Saucy 13.10 (64 bit)
14
15Sample pillar
16-------------
17
Filip Pytloune27a90d2016-08-29 14:08:34 +020018Host
19----
20
Michael Kutý17649402016-03-19 23:57:43 +010021.. code-block:: yaml
22
23 docker:
24 host:
25 enabled: true
Ruslan Khozinov6f34b6f2017-03-27 16:30:19 +000026 experimental: true
Filip Pytloun972294d2016-09-15 17:52:32 +020027 insecure_registries:
28 - 127.0.0.1
Jakub Pavlik18a58eb2016-11-02 15:12:17 +010029 log:
30 engine: json-file
31 size: 50m
Michael Kutý17649402016-03-19 23:57:43 +010032
Filip Pytloun2720a0d2016-11-02 14:15:55 +010033Swarm
34-----
35
36Role can be master, manager or worker. Where master is the first manager that
37will initialize the swarm.
38
39Metadata for manager (first node):
40
41.. code-block:: yaml
42
43 docker:
44 host:
45 enabled: true
46 swarm:
47 role: manager
48 advertise_addr: 192.168.1.5
49 bind:
50 address: 192.168.1.5
51 port: 2377
52
53Metadata for worker:
54
55.. code-block:: yaml
56
57 docker:
58 host:
59 enabled: true
60 swarm:
61 role: worker
62 master:
63 host: 192.168.1.5
64 port: 2377
65
66Token to join to master node is obtained from grains using salt.mine. In case
67of any ``join_token undefined`` issues, ensure you have ``docker_swarm_``
68grains available.
69
Filip Pytloune27a90d2016-08-29 14:08:34 +020070Client
71------
Michael Kutý17649402016-03-19 23:57:43 +010072
Filip Pytloun96fc0cc2016-08-29 16:01:10 +020073Container
74~~~~~~~~~
75
76.. code-block:: yaml
77
Michael Kutý17649402016-03-19 23:57:43 +010078 docker:
Filip Pytloune27a90d2016-08-29 14:08:34 +020079 client:
Michael Kutý17649402016-03-19 23:57:43 +010080 container:
Filip Pytloun87169542016-08-29 13:38:30 +020081 jenkins:
82 # Don't start automatically
83 start: false
84 restart: unless-stopped
85 image: jenkins:2.7.1
Michael Kutý17649402016-03-19 23:57:43 +010086 ports:
Filip Pytloun87169542016-08-29 13:38:30 +020087 - 8081:8080
88 - 50000:50000
89 environment:
90 JAVA_OPTS: "-Dhudson.footerURL=https://www.example.com"
91 volumes:
92 - /srv/volumes/jenkins:/var/jenkins_home
Michael Kutý17649402016-03-19 23:57:43 +010093
Filip Pytloun96fc0cc2016-08-29 16:01:10 +020094Compose
95~~~~~~~
96
Filip Pytloun21d9af92016-08-30 08:13:39 +020097There are three options how to install docker-compose:
98
99- distribution package (default)
100- using Pip
101- using Docker container
102
103Install docker-compose using Docker (default is distribution package)
Filip Pytloun96fc0cc2016-08-29 16:01:10 +0200104
105.. code-block:: yaml
106
107 docker:
108 client:
109 compose:
Filip Pytloun21d9af92016-08-30 08:13:39 +0200110 source:
111 engine: docker
112 image: docker/compose:1.8.0
Filip Pytloun96fc0cc2016-08-29 16:01:10 +0200113 django_web:
114 # Run up action, any positional argument to docker-compose CLI
115 # If not defined, only docker-compose.yml is generated
116 status: up
Filip Pytlounbe2b4a82016-09-15 18:10:24 +0200117 # Run image pull every time state is run triggering container
118 # restart in case it's changed
119 pull: true
Filip Pytloun96fc0cc2016-08-29 16:01:10 +0200120 environment:
121 SOMEVAR: somevalue
122 service:
123 db:
124 image: postgres
125 web:
126 image: djangoapp
127 volumes:
128 - /srv/volumes/django:/srv/django
129 ports:
130 - 8000:8000
131 depends_on:
132 - db
133
Filip Pytlounab52ede2016-11-02 16:59:49 +0100134Service
135-------
136
137To deploy service in Swarm mode, you can use ``docker.client.service``:
138
139.. code-block:: yaml
140
141 parameters:
142 docker:
143 client:
144 service:
145 postgresql:
146 environment:
147 POSTGRES_USER: user
148 POSTGRES_PASSWORD: password
149 POSTGRES_DB: mydb
150 restart:
151 condition: on-failure
152 image: "postgres:9.5"
153 ports:
154 - 5432:5432
155 volume:
156 data:
157 type: bind
158 source: /srv/volumes/postgresql/maas
159 destination: /var/lib/postgresql/data
160
Filip Pytloun96fc0cc2016-08-29 16:01:10 +0200161
Filip Pytlounbaf94c92016-06-07 18:07:17 +0200162Registry
163--------
164
165.. code-block:: yaml
166
167 docker:
168 registry:
169 log:
170 level: debug
171 formatter: json
172 cache:
173 engine: redis
174 host: localhost
175 storage:
176 engine: filesystem
177 root: /srv/docker/registry
178 bind:
179 host: 0.0.0.0
180 port: 5000
181 hook:
182 mail:
183 levels:
184 - panic
185 # Options are rendered as yaml as is so use hook-specific options here
186 options:
187 smtp:
188 addr: smtp.sendhost.com:25
189 username: sendername
190 password: password
191 insecure: true
192 from: name@sendhost.com
193 to:
194 - name@receivehost.com
195
marco85b72a62016-07-07 13:08:33 +0200196Docker login to private registry
197--------------------------------
198
199.. code-block:: yaml
200
201 docker:
202 host:
203 enabled: true
204 registry:
205 first:
206 address: private.docker.com
207 user: username
208 password: password
209 second:
210 address: private2.docker.com
211 user: username2
212 password: password2
Michael Kutý17649402016-03-19 23:57:43 +0100213
214Read more
215---------
216
217* https://docs.docker.com/installation/ubuntulinux/
218* https://github.com/saltstack-formulas/docker-formula
Filip Pytlounbaf94c92016-06-07 18:07:17 +0200219
Filip Pytlound617a762017-02-02 13:02:03 +0100220
221Documentation and Bugs
222======================
223
224To learn how to install and update salt-formulas, consult the documentation
225available online at:
226
227 http://salt-formulas.readthedocs.io/
228
229In the unfortunate event that bugs are discovered, they should be reported to
230the appropriate issue tracker. Use Github issue tracker for specific salt
231formula:
232
233 https://github.com/salt-formulas/salt-formula-docker/issues
234
235For feature requests, bug reports or blueprints affecting entire ecosystem,
236use Launchpad salt-formulas project:
237
238 https://launchpad.net/salt-formulas
239
240You can also join salt-formulas-users team and subscribe to mailing list:
241
242 https://launchpad.net/~salt-formulas-users
243
244Developers wishing to work on the salt-formulas projects should always base
245their work on master branch and submit pull request against specific formula.
246
247 https://github.com/salt-formulas/salt-formula-docker
248
249Any questions or feedback is always welcome so feel free to join our IRC
250channel:
251
252 #salt-formulas @ irc.freenode.net