Michael Kutý | 1764940 | 2016-03-19 23:57:43 +0100 | [diff] [blame] | 1 | |
Aleš Komárek | 028b885 | 2017-04-11 13:10:58 +0200 | [diff] [blame^] | 2 | ============== |
| 3 | Docker Formula |
| 4 | ============== |
Michael Kutý | 1764940 | 2016-03-19 23:57:43 +0100 | [diff] [blame] | 5 | |
| 6 | Docker 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 | |
| 8 | Docker 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árek | 028b885 | 2017-04-11 13:10:58 +0200 | [diff] [blame^] | 15 | Sample Pillars |
| 16 | ============== |
Michael Kutý | 1764940 | 2016-03-19 23:57:43 +0100 | [diff] [blame] | 17 | |
Aleš Komárek | 028b885 | 2017-04-11 13:10:58 +0200 | [diff] [blame^] | 18 | Docker Host |
| 19 | ----------- |
Filip Pytloun | e27a90d | 2016-08-29 14:08:34 +0200 | [diff] [blame] | 20 | |
Michael Kutý | 1764940 | 2016-03-19 23:57:43 +0100 | [diff] [blame] | 21 | .. code-block:: yaml |
| 22 | |
| 23 | docker: |
| 24 | host: |
| 25 | enabled: true |
Ruslan Khozinov | 6f34b6f | 2017-03-27 16:30:19 +0000 | [diff] [blame] | 26 | experimental: true |
Filip Pytloun | 972294d | 2016-09-15 17:52:32 +0200 | [diff] [blame] | 27 | insecure_registries: |
| 28 | - 127.0.0.1 |
Jakub Pavlik | 18a58eb | 2016-11-02 15:12:17 +0100 | [diff] [blame] | 29 | log: |
| 30 | engine: json-file |
| 31 | size: 50m |
Michael Kutý | 1764940 | 2016-03-19 23:57:43 +0100 | [diff] [blame] | 32 | |
Aleš Komárek | 028b885 | 2017-04-11 13:10:58 +0200 | [diff] [blame^] | 33 | |
| 34 | Docker Swarm |
| 35 | ------------ |
Filip Pytloun | 2720a0d | 2016-11-02 14:15:55 +0100 | [diff] [blame] | 36 | |
| 37 | Role can be master, manager or worker. Where master is the first manager that |
| 38 | will initialize the swarm. |
| 39 | |
| 40 | Metadata 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árek | 028b885 | 2017-04-11 13:10:58 +0200 | [diff] [blame^] | 54 | Metadata for worker. |
Filip Pytloun | 2720a0d | 2016-11-02 14:15:55 +0100 | [diff] [blame] | 55 | |
| 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 | |
| 67 | Token to join to master node is obtained from grains using salt.mine. In case |
| 68 | of any ``join_token undefined`` issues, ensure you have ``docker_swarm_`` |
| 69 | grains available. |
| 70 | |
Aleš Komárek | 028b885 | 2017-04-11 13:10:58 +0200 | [diff] [blame^] | 71 | Docker Client |
| 72 | ------------- |
Michael Kutý | 1764940 | 2016-03-19 23:57:43 +0100 | [diff] [blame] | 73 | |
Filip Pytloun | 96fc0cc | 2016-08-29 16:01:10 +0200 | [diff] [blame] | 74 | Container |
| 75 | ~~~~~~~~~ |
| 76 | |
| 77 | .. code-block:: yaml |
| 78 | |
Michael Kutý | 1764940 | 2016-03-19 23:57:43 +0100 | [diff] [blame] | 79 | docker: |
Filip Pytloun | e27a90d | 2016-08-29 14:08:34 +0200 | [diff] [blame] | 80 | client: |
Michael Kutý | 1764940 | 2016-03-19 23:57:43 +0100 | [diff] [blame] | 81 | container: |
Filip Pytloun | 8716954 | 2016-08-29 13:38:30 +0200 | [diff] [blame] | 82 | jenkins: |
| 83 | # Don't start automatically |
| 84 | start: false |
| 85 | restart: unless-stopped |
| 86 | image: jenkins:2.7.1 |
Michael Kutý | 1764940 | 2016-03-19 23:57:43 +0100 | [diff] [blame] | 87 | ports: |
Filip Pytloun | 8716954 | 2016-08-29 13:38:30 +0200 | [diff] [blame] | 88 | - 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ý | 1764940 | 2016-03-19 23:57:43 +0100 | [diff] [blame] | 94 | |
Aleš Komárek | 028b885 | 2017-04-11 13:10:58 +0200 | [diff] [blame^] | 95 | Using Docker Compose |
| 96 | ~~~~~~~~~~~~~~~~~~~~ |
Filip Pytloun | 96fc0cc | 2016-08-29 16:01:10 +0200 | [diff] [blame] | 97 | |
Filip Pytloun | 21d9af9 | 2016-08-30 08:13:39 +0200 | [diff] [blame] | 98 | There are three options how to install docker-compose: |
| 99 | |
| 100 | - distribution package (default) |
| 101 | - using Pip |
| 102 | - using Docker container |
| 103 | |
| 104 | Install docker-compose using Docker (default is distribution package) |
Filip Pytloun | 96fc0cc | 2016-08-29 16:01:10 +0200 | [diff] [blame] | 105 | |
| 106 | .. code-block:: yaml |
| 107 | |
| 108 | docker: |
| 109 | client: |
| 110 | compose: |
Filip Pytloun | 21d9af9 | 2016-08-30 08:13:39 +0200 | [diff] [blame] | 111 | source: |
| 112 | engine: docker |
| 113 | image: docker/compose:1.8.0 |
Filip Pytloun | 96fc0cc | 2016-08-29 16:01:10 +0200 | [diff] [blame] | 114 | 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 Pytloun | be2b4a8 | 2016-09-15 18:10:24 +0200 | [diff] [blame] | 118 | # Run image pull every time state is run triggering container |
| 119 | # restart in case it's changed |
| 120 | pull: true |
Filip Pytloun | 96fc0cc | 2016-08-29 16:01:10 +0200 | [diff] [blame] | 121 | 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 Pytloun | ab52ede | 2016-11-02 16:59:49 +0100 | [diff] [blame] | 135 | To 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 Pytloun | 96fc0cc | 2016-08-29 16:01:10 +0200 | [diff] [blame] | 159 | |
Aleš Komárek | 028b885 | 2017-04-11 13:10:58 +0200 | [diff] [blame^] | 160 | Docker Registry |
| 161 | --------------- |
Filip Pytloun | baf94c9 | 2016-06-07 18:07:17 +0200 | [diff] [blame] | 162 | |
| 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 | |
marco | 85b72a6 | 2016-07-07 13:08:33 +0200 | [diff] [blame] | 194 | Docker login to private registry |
marco | 85b72a6 | 2016-07-07 13:08:33 +0200 | [diff] [blame] | 195 | |
| 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ý | 1764940 | 2016-03-19 23:57:43 +0100 | [diff] [blame] | 210 | |
Aleš Komárek | 028b885 | 2017-04-11 13:10:58 +0200 | [diff] [blame^] | 211 | |
| 212 | More Information |
| 213 | ================ |
Michael Kutý | 1764940 | 2016-03-19 23:57:43 +0100 | [diff] [blame] | 214 | |
| 215 | * https://docs.docker.com/installation/ubuntulinux/ |
| 216 | * https://github.com/saltstack-formulas/docker-formula |
Filip Pytloun | baf94c9 | 2016-06-07 18:07:17 +0200 | [diff] [blame] | 217 | |
Filip Pytloun | d617a76 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 218 | |
| 219 | Documentation and Bugs |
| 220 | ====================== |
| 221 | |
| 222 | To learn how to install and update salt-formulas, consult the documentation |
| 223 | available online at: |
| 224 | |
| 225 | http://salt-formulas.readthedocs.io/ |
| 226 | |
| 227 | In the unfortunate event that bugs are discovered, they should be reported to |
| 228 | the appropriate issue tracker. Use Github issue tracker for specific salt |
| 229 | formula: |
| 230 | |
| 231 | https://github.com/salt-formulas/salt-formula-docker/issues |
| 232 | |
| 233 | For feature requests, bug reports or blueprints affecting entire ecosystem, |
| 234 | use Launchpad salt-formulas project: |
| 235 | |
| 236 | https://launchpad.net/salt-formulas |
| 237 | |
| 238 | You can also join salt-formulas-users team and subscribe to mailing list: |
| 239 | |
| 240 | https://launchpad.net/~salt-formulas-users |
| 241 | |
| 242 | Developers wishing to work on the salt-formulas projects should always base |
| 243 | their work on master branch and submit pull request against specific formula. |
| 244 | |
| 245 | https://github.com/salt-formulas/salt-formula-docker |
| 246 | |
| 247 | Any questions or feedback is always welcome so feel free to join our IRC |
| 248 | channel: |
| 249 | |
| 250 | #salt-formulas @ irc.freenode.net |