A 2-hour training session delivered at AtlasCamp in Prague, June 9th 2015.
* Docker vs virtual machines
* Docker concepts
* Docker for testing
* Automation with Docker Compose
* Continuous integration with Bamboo Docker support
* Extracting test results from Docker containers
* Continuous deployment with deployment environments
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
AtlasCamp 2015 Docker continuous integration training
1. Continuous Integration with
Docker and Bamboo
STEVE SMITH • DEVOPS ADVOCATE • ATLASSIAN • @TARKASTEVE
https://bitbucket.org/ssmith/atlascamp2015-docker-ci
7. Using features of the Linux kernel
Docker
libcontainer
systemd
nspawn
libvirt
cgroups
CPU accounting
Namespaces
Posix capabilities
btrfs
OverlayFS
LXC
19. Inspecting the stack
[ssmith] $ docker history mynginx
IMAGE CREATED CREATED BY
606f0f611cb2 6 days ago /bin/sh -c #(nop) CMD [nginx -g daemon off;]
27d0fad8620d 6 days ago /bin/sh -c #(nop) EXPOSE map[443/tcp:{}]
dc26b50e9806 6 days ago /bin/sh -c #(nop) EXPOSE map[80/tcp:{}]
7a04b014a0a7 6 days ago /bin/sh -c apt-get update && apt-get install
b39b81afc8ca 9 days ago /bin/sh -c #(nop) CMD [/bin/bash]
615c102e2290 9 days ago /bin/sh -c sed -i 's/^#s*(deb.*universe)$/
837339b91538 9 days ago /bin/sh -c echo '#!/bin/sh' > /usr/sbin/polic
53f858aaaf03 9 days ago /bin/sh -c #(nop) ADD file:ca5b63647c6b7a419e
511136ea3c5a 19 months ago
36. Manual run
[ssmith] docker run -d —name=postgres postgres
181470ed78836c9285664c18f0d5b4c6a9069d28c4f71b9d621d4c24762ad938
[ssmith] docker run -d --name=elasticsearch elasticsearch
5718e1ba9b7caf0e25f53d803a128d2a3d4d518ae8d747b843cc2cbdd78620ce
[smith] docker run --link postgres:postgres --link elasticsearch:elasticsearch transfer
Waiting for TCP connection to elasticsearch:9200...OK
Waiting for TCP connection to postgres:5432...OK
Received notification for accountupdate for 55d3290b-5baa-4ca6-b353-cacf5b104c60
Performing update of 55d3290b-5baa-4ca6-b353-cacf5b104c60
Indexing row 55d3290b-5baa-4ca6-b353-cacf5b104c60 Mr. 55d3290b 55d3290b Esq.
Dispatch complete
37. Manual cleanup
[ssmith] docker ps
CONTAINER ID IMAGE COMMAND CREATED …
5718e1ba9b7c elasticsearch:latest "/bin/sh -c '/opt/el 5 minutes ago …
181470ed7883 postgres:latest "/docker-entrypoint. 6 minutes ago …
[ssmith] docker kill elasticsearch postgres
elasticsearch
postgres
[ssmith] docker ps
CONTAINER ID IMAGE COMMAND CREATED …
[ssmith] docker ps -a
CONTAINER ID IMAGE COMMAND CREATED
ff6e5409d8ba transfer:latest "/bin/sh -c 'waitpor 11 minutes ago
5718e1ba9b7c elasticsearch:latest "/bin/sh -c '/opt/el 11 minutes ago
181470ed7883 postgres:latest "/docker-entrypoint. 11 minutes ago
[smith] docker rm transfer postgres elasticsearch
transfer
postgres
elasticsearch
42. Compose Run
[ssmith] docker-compose up
Creating devweek15code_postgres_1...
Creating devweek15code_elasticsearch_1...
Creating devweek15code_transfer_1...
Attaching to devweek15code_postgres_1, devweek15code_elasticsearch_1, devweek15code_transfer_1
postgres_1 | The files belonging to this database system will be owned by user "postgres".
postgres_1 | This user must also own the server process.
<SNIP> <SNIP> <SNIP> <SNIP> <SNIP>
transfer_1 | Waiting for TCP connection to postgres:5432...OK
transfer_1 | Received notification for accountupdate for dcf286bf-7011-40f5-abb0-153d94acde
transfer_1 | Performing update of dcf286bf-7011-40f5-abb0-153d94acde69
transfer_1 | Indexing row dcf286bf-7011-40f5-abb0-153d94acde69 Mr. dcf286bf dcf286bf Esq.
elasticsearch_1 | creating index, cause [auto(index api)], shards [5]/[1], mappings []
elasticsearch_1 | update_mapping [account] (dynamic)
transfer_1 | Dispatch complete
devweek15code_transfer_1 exited with code 0
Gracefully stopping... (press Ctrl+C again to force)
Stopping devweek15code_elasticsearch_1...
Stopping devweek15code_postgres_1...