blob: 40c293fd27d8285646f852561f72705d79cf063e [file] [log] [blame]
Michael Kutý17649402016-03-19 23:57:43 +01001
Aleš Komárek028b8852017-04-11 13:10:58 +02002==============
3Docker Formula
4==============
Michael Kutý17649402016-03-19 23:57:43 +01005
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
Aleš Komárek028b8852017-04-11 13:10:58 +020015Sample Pillars
16==============
Michael Kutý17649402016-03-19 23:57:43 +010017
Aleš Komárek028b8852017-04-11 13:10:58 +020018Docker Host
19-----------
Filip Pytloune27a90d2016-08-29 14:08:34 +020020
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
Aleš Komárek028b8852017-04-11 13:10:58 +020033
34Docker Swarm
35------------
Filip Pytloun2720a0d2016-11-02 14:15:55 +010036
37Role can be master, manager or worker. Where master is the first manager that
38will initialize the swarm.
39
40Metadata for manager (first node):
41
42.. code-block:: yaml
43
44 docker:
45 host:
46 enabled: true
47 swarm:
48 role: manager
49 advertise_addr: 192.168.1.5
50 bind:
51 address: 192.168.1.5
52 port: 2377
53
Aleš Komárek028b8852017-04-11 13:10:58 +020054Metadata for worker.
Filip Pytloun2720a0d2016-11-02 14:15:55 +010055
56.. code-block:: yaml
57
58 docker:
59 host:
60 enabled: true
61 swarm:
62 role: worker
63 master:
64 host: 192.168.1.5
65 port: 2377
66
67Token to join to master node is obtained from grains using salt.mine. In case
68of any ``join_token undefined`` issues, ensure you have ``docker_swarm_``
69grains available.
70
Aleš Komárek028b8852017-04-11 13:10:58 +020071Docker Client
72-------------
Michael Kutý17649402016-03-19 23:57:43 +010073
Filip Pytloun96fc0cc2016-08-29 16:01:10 +020074Container
75~~~~~~~~~
76
77.. code-block:: yaml
78
Michael Kutý17649402016-03-19 23:57:43 +010079 docker:
Filip Pytloune27a90d2016-08-29 14:08:34 +020080 client:
Michael Kutý17649402016-03-19 23:57:43 +010081 container:
Filip Pytloun87169542016-08-29 13:38:30 +020082 jenkins:
83 # Don't start automatically
84 start: false
85 restart: unless-stopped
86 image: jenkins:2.7.1
Michael Kutý17649402016-03-19 23:57:43 +010087 ports:
Filip Pytloun87169542016-08-29 13:38:30 +020088 - 8081:8080
89 - 50000:50000
90 environment:
91 JAVA_OPTS: "-Dhudson.footerURL=https://www.example.com"
92 volumes:
93 - /srv/volumes/jenkins:/var/jenkins_home
Michael Kutý17649402016-03-19 23:57:43 +010094
Aleš Komárek028b8852017-04-11 13:10:58 +020095Using Docker Compose
96~~~~~~~~~~~~~~~~~~~~
Filip Pytloun96fc0cc2016-08-29 16:01:10 +020097
Filip Pytloun21d9af92016-08-30 08:13:39 +020098There are three options how to install docker-compose:
99
100- distribution package (default)
101- using Pip
102- using Docker container
103
104Install docker-compose using Docker (default is distribution package)
Filip Pytloun96fc0cc2016-08-29 16:01:10 +0200105
106.. code-block:: yaml
107
108 docker:
109 client:
110 compose:
Filip Pytloun21d9af92016-08-30 08:13:39 +0200111 source:
112 engine: docker
113 image: docker/compose:1.8.0
Filip Pytloun96fc0cc2016-08-29 16:01:10 +0200114 django_web:
115 # Run up action, any positional argument to docker-compose CLI
116 # If not defined, only docker-compose.yml is generated
117 status: up
Filip Pytlounbe2b4a82016-09-15 18:10:24 +0200118 # Run image pull every time state is run triggering container
119 # restart in case it's changed
120 pull: true
Filip Pytloun96fc0cc2016-08-29 16:01:10 +0200121 environment:
122 SOMEVAR: somevalue
123 service:
124 db:
125 image: postgres
126 web:
127 image: djangoapp
128 volumes:
129 - /srv/volumes/django:/srv/django
130 ports:
131 - 8000:8000
132 depends_on:
133 - db
134
Filip Pytlounab52ede2016-11-02 16:59:49 +0100135To deploy service in Swarm mode, you can use ``docker.client.service``:
136
137.. code-block:: yaml
138
139 parameters:
140 docker:
141 client:
142 service:
143 postgresql:
144 environment:
145 POSTGRES_USER: user
146 POSTGRES_PASSWORD: password
147 POSTGRES_DB: mydb
148 restart:
149 condition: on-failure
150 image: "postgres:9.5"
151 ports:
152 - 5432:5432
153 volume:
154 data:
155 type: bind
156 source: /srv/volumes/postgresql/maas
157 destination: /var/lib/postgresql/data
158
Filip Pytloun96fc0cc2016-08-29 16:01:10 +0200159
Aleš Komárek028b8852017-04-11 13:10:58 +0200160Docker Registry
161---------------
Filip Pytlounbaf94c92016-06-07 18:07:17 +0200162
163.. code-block:: yaml
164
165 docker:
166 registry:
167 log:
168 level: debug
169 formatter: json
170 cache:
171 engine: redis
172 host: localhost
173 storage:
174 engine: filesystem
175 root: /srv/docker/registry
176 bind:
177 host: 0.0.0.0
178 port: 5000
179 hook:
180 mail:
181 levels:
182 - panic
183 # Options are rendered as yaml as is so use hook-specific options here
184 options:
185 smtp:
186 addr: smtp.sendhost.com:25
187 username: sendername
188 password: password
189 insecure: true
190 from: name@sendhost.com
191 to:
192 - name@receivehost.com
193
marco85b72a62016-07-07 13:08:33 +0200194Docker login to private registry
marco85b72a62016-07-07 13:08:33 +0200195
196.. code-block:: yaml
197
198 docker:
199 host:
200 enabled: true
201 registry:
202 first:
203 address: private.docker.com
204 user: username
205 password: password
206 second:
207 address: private2.docker.com
208 user: username2
209 password: password2
Michael Kutý17649402016-03-19 23:57:43 +0100210
Aleš Komárek028b8852017-04-11 13:10:58 +0200211
212More Information
213================
Michael Kutý17649402016-03-19 23:57:43 +0100214
215* https://docs.docker.com/installation/ubuntulinux/
216* https://github.com/saltstack-formulas/docker-formula
Filip Pytlounbaf94c92016-06-07 18:07:17 +0200217
Filip Pytlound617a762017-02-02 13:02:03 +0100218
219Documentation and Bugs
220======================
221
222To learn how to install and update salt-formulas, consult the documentation
223available online at:
224
225 http://salt-formulas.readthedocs.io/
226
227In the unfortunate event that bugs are discovered, they should be reported to
228the appropriate issue tracker. Use Github issue tracker for specific salt
229formula:
230
231 https://github.com/salt-formulas/salt-formula-docker/issues
232
233For feature requests, bug reports or blueprints affecting entire ecosystem,
234use Launchpad salt-formulas project:
235
236 https://launchpad.net/salt-formulas
237
238You can also join salt-formulas-users team and subscribe to mailing list:
239
240 https://launchpad.net/~salt-formulas-users
241
242Developers wishing to work on the salt-formulas projects should always base
243their work on master branch and submit pull request against specific formula.
244
245 https://github.com/salt-formulas/salt-formula-docker
246
247Any questions or feedback is always welcome so feel free to join our IRC
248channel:
249
250 #salt-formulas @ irc.freenode.net