Baptiste MOINE <contact@bmoine.fr>
@Creased_
~$> whois bmoine.fr
%%
%% Please contact Baptiste MOINE <contact@bmoine.fr> to obtain more information about me.
%%
contact:     Baptiste MOINE
country:     FR
e-mail:      contact@bmoine.fr
website:     https://www.bmoine.fr
website:     https://git.bmoine.fr
website:     https://twitter.com/Creased_
motto:       Learning is Endless
status:      ACTIVE
last-update: 1s ago
trouble:     Information: https://www.bmoine.fr
trouble:     Questions:  mailto:contact@bmoine.fr
trouble:     Spam: rm -rf / 2>/dev/nullDocker: An easy introduction to containerization
2
What's Docker?
4
How it works?
5
How to use it?
7
Immutable service?
9
Go further
11
Docker: An easy introduction to containerization
3
Docker: An easy introduction to containerization
4
Docker: An easy introduction to containerization
5
Linux Containers vs. Docker
CC-BY-NC-SA Baptiste MOINE – bmoine.fr
any app, anywhere!
Docker: An easy introduction to containerization
6
$> docker run --rm --detach --interactive --tty \
              --hostname demo-nginx --name demo-nginx \
              --network bridge --publish 80:80/tcp \
              --health-cmd "wget -s -q http://127.0.0.1/ && echo \"Up\" || echo \"Down\"" \
              --health-interval 5s --health-timeout 3s \
          library/nginx:stable-alpine
aa64bb4ab8830d2b5f5c52b5f9490c6d576b4c21bc50a1174b56156181eeb8e3
$> docker logs demo-nginx
127.0.0.1 - - [20/Feb/2018:05:20:00 +0000] "GET / HTTP/1.1" 200 612 "-" "Wget" "-"
$> docker ps --filter "name=demo-nginx" --format "{{ .Status }}"
Up 5 seconds (healthy)
$> docker stop demo-nginxunsustainable, tedious
Docker: An easy introduction to containerization
7
$> docker-compose up -d
Creating network "dockerdemo_front" with driver "bridge"
Creating demo-nginx ... done
$> docker-compose logs
Attaching to demo-nginx
demo-nginx | 127.0.0.1 - - [20/Feb/2018:05:20:00 +0000] "GET / HTTP/1.1" 200 612 "-" "Wget" "-"
$> docker-compose ps
   Name            Command          State         Ports       
--------------------------------------------------------------
demo-nginx   nginx -g daemon off;   Up      0.0.0.0:80->80/tcp
accessible, efficient
Docker: An easy introduction to containerization
8
#
# Nginx Dockerfile
#
# Written by:
#   Baptiste MOINE <contact@bmoine.fr>
#
# Pull base image.
FROM library/nginx:stable-alpine
# Describe image.
MAINTAINER Baptiste MOINE <contact@bmoine.fr>
# Copy startup script.
COPY ./start.sh /start.sh
RUN chmod +x /start.sh
# Define command and entrypoint.
CMD ["/start.sh"]
Docker: An easy introduction to containerization
9
user-friendly, maintainable
$> docker-compose pull
$> docker-compose build
Successfully built a4aea8a6250f
Successfully tagged creased/nginx:stable-alpine
$> docker-compose push
$> docker-compose up -d
Creating network "dockerdemo_front" with driver "bridge"
Creating demo-nginx ... done
$> docker-compose logs
Attaching to demo-nginx
demo-nginx | 127.0.0.1 - - [20/Feb/2018:05:20:00 +0000] "GET / HTTP/1.1" 200 612 "-" "Wget" "-"
$> docker-compose ps
   Name            Command          State         Ports       
--------------------------------------------------------------
demo-nginx   nginx -g daemon off;   Up      0.0.0.0:80->80/tcp
Docker: An easy introduction to containerization
10
fast, memory-friendly
CI/CD pipeline based on GitLab
CC-BY-NC-SA Baptiste MOINE – bmoine.fr
Docker: An easy introduction to containerization
11
Docker: An easy introduction to containerization
12