blob: 7884960e00c29bde890a194874e648f09e7e67ee [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
Filip Pytloun972294d2016-09-15 17:52:32 +020026 insecure_registries:
27 - 127.0.0.1
Michael Kutý17649402016-03-19 23:57:43 +010028
Filip Pytloun2720a0d2016-11-02 14:15:55 +010029Swarm
30-----
31
32Role can be master, manager or worker. Where master is the first manager that
33will initialize the swarm.
34
35Metadata for manager (first node):
36
37.. code-block:: yaml
38
39 docker:
40 host:
41 enabled: true
42 swarm:
43 role: manager
44 advertise_addr: 192.168.1.5
45 bind:
46 address: 192.168.1.5
47 port: 2377
48
49Metadata for worker:
50
51.. code-block:: yaml
52
53 docker:
54 host:
55 enabled: true
56 swarm:
57 role: worker
58 master:
59 host: 192.168.1.5
60 port: 2377
61
62Token to join to master node is obtained from grains using salt.mine. In case
63of any ``join_token undefined`` issues, ensure you have ``docker_swarm_``
64grains available.
65
Filip Pytloune27a90d2016-08-29 14:08:34 +020066Client
67------
Michael Kutý17649402016-03-19 23:57:43 +010068
Filip Pytloun96fc0cc2016-08-29 16:01:10 +020069Container
70~~~~~~~~~
71
72.. code-block:: yaml
73
Michael Kutý17649402016-03-19 23:57:43 +010074 docker:
Filip Pytloune27a90d2016-08-29 14:08:34 +020075 client:
Michael Kutý17649402016-03-19 23:57:43 +010076 container:
Filip Pytloun87169542016-08-29 13:38:30 +020077 jenkins:
78 # Don't start automatically
79 start: false
80 restart: unless-stopped
81 image: jenkins:2.7.1
Michael Kutý17649402016-03-19 23:57:43 +010082 ports:
Filip Pytloun87169542016-08-29 13:38:30 +020083 - 8081:8080
84 - 50000:50000
85 environment:
86 JAVA_OPTS: "-Dhudson.footerURL=https://www.example.com"
87 volumes:
88 - /srv/volumes/jenkins:/var/jenkins_home
Michael Kutý17649402016-03-19 23:57:43 +010089
Filip Pytloun96fc0cc2016-08-29 16:01:10 +020090Compose
91~~~~~~~
92
Filip Pytloun21d9af92016-08-30 08:13:39 +020093There are three options how to install docker-compose:
94
95- distribution package (default)
96- using Pip
97- using Docker container
98
99Install docker-compose using Docker (default is distribution package)
Filip Pytloun96fc0cc2016-08-29 16:01:10 +0200100
101.. code-block:: yaml
102
103 docker:
104 client:
105 compose:
Filip Pytloun21d9af92016-08-30 08:13:39 +0200106 source:
107 engine: docker
108 image: docker/compose:1.8.0
Filip Pytloun96fc0cc2016-08-29 16:01:10 +0200109 django_web:
110 # Run up action, any positional argument to docker-compose CLI
111 # If not defined, only docker-compose.yml is generated
112 status: up
Filip Pytlounbe2b4a82016-09-15 18:10:24 +0200113 # Run image pull every time state is run triggering container
114 # restart in case it's changed
115 pull: true
Filip Pytloun96fc0cc2016-08-29 16:01:10 +0200116 environment:
117 SOMEVAR: somevalue
118 service:
119 db:
120 image: postgres
121 web:
122 image: djangoapp
123 volumes:
124 - /srv/volumes/django:/srv/django
125 ports:
126 - 8000:8000
127 depends_on:
128 - db
129
130
Filip Pytlounbaf94c92016-06-07 18:07:17 +0200131Registry
132--------
133
134.. code-block:: yaml
135
136 docker:
137 registry:
138 log:
139 level: debug
140 formatter: json
141 cache:
142 engine: redis
143 host: localhost
144 storage:
145 engine: filesystem
146 root: /srv/docker/registry
147 bind:
148 host: 0.0.0.0
149 port: 5000
150 hook:
151 mail:
152 levels:
153 - panic
154 # Options are rendered as yaml as is so use hook-specific options here
155 options:
156 smtp:
157 addr: smtp.sendhost.com:25
158 username: sendername
159 password: password
160 insecure: true
161 from: name@sendhost.com
162 to:
163 - name@receivehost.com
164
marco85b72a62016-07-07 13:08:33 +0200165Docker login to private registry
166--------------------------------
167
168.. code-block:: yaml
169
170 docker:
171 host:
172 enabled: true
173 registry:
174 first:
175 address: private.docker.com
176 user: username
177 password: password
178 second:
179 address: private2.docker.com
180 user: username2
181 password: password2
Michael Kutý17649402016-03-19 23:57:43 +0100182
183Read more
184---------
185
186* https://docs.docker.com/installation/ubuntulinux/
187* https://github.com/saltstack-formulas/docker-formula
Filip Pytlounbaf94c92016-06-07 18:07:17 +0200188