Baptiste MOINE
#SysAdmin driven by curiosity ~ #InfoSec involved student ~ Keen interest in team-based security challenges ~ 0x860B5424
Baptiste MOINE <contact@bmoine.fr>
@Creased_
Intégration de Docker au cœur du développement
Formation Docker
1
L'objectif de cette formation est de vous permettre de mieux
appréhender l'intégration de Docker au cœur de la chaîne de développement logiciel
Qu’est-ce que Docker ?
3
Virtualisation ou conteneurisation ?
4
Architecture de Docker
5
Fonctionnement de Docker
6
Utilisation de Docker
7
Sécurité au cœur du développement
8
Conclusion
9
TD
10
Formation Docker
2
Formation Docker
3
Formation Docker
4
Virtualization vs. Docker
CC-BY-NC-SA Baptiste MOINE – bmoine.fr
Formation Docker
5-1
Formation Docker
5-2
Formation Docker
6-1
COMPOSE_PROJECT_NAME=hello
.env
#
# Hello-World.
#
version: '3'
services:
hello:
build: build/
image: creased/demo-hello-world:latest
container_name: ${COMPOSE_PROJECT_NAME:-service}
hostname: ${COMPOSE_PROJECT_NAME:-service}
restart: "no"
networks: {}
docker-compose.yml
Formation Docker
6-2
# Builder.
FROM debian:stretch-slim AS builder
ENV DEBIAN_FRONTEND noninteractive
RUN dpkg --add-architecture i386 && \
apt update && \
apt install -y --no-install-recommends --no-install-suggests make gcc-multilib libc6-dev:i386
COPY ./src /data
WORKDIR /data
RUN make
## Runner.
FROM scratch AS runner
COPY --from=builder /data/app /app
CMD ["/app"]
Dockerfile
Formation Docker
6-3
Formation Docker
6-4
$> docker-compose pull
$> docker-compose build
Successfully built fb6dfb055c36
Successfully tagged creased/demo-hello-world:latest
$> docker-compose push
$> docker-compose up -d
Starting hello ... done
$> docker-compose logs
Attaching to hello
hello | /app[1]: Hello, World!
$> docker-compose ps
Name Command State Ports
--------------------------------
hello /app Exit 0
Formation Docker
7-1
$> docker-compose up -d
Creating pong-server ... done
Creating pong-client ... done
$> docker-compose logs
Attaching to pong-client, pong-server
pong-server | 2019-07-09 13:54:44,228 - server - INFO - Serving on 172.20.0.2:42 (press ctrl-c to stop)
pong-client | 2019-07-09 13:54:44,952 - client - INFO - Sending 'Ping\n' to 172.20.0.2:42...
pong-server | 2019-07-09 13:54:44,953 - server - INFO - Sending 'Pong\n' to 172.20.0.3:56160...
pong-server | 2019-07-09 13:54:44,954 - server - INFO - Connection closed for 172.20.0.3:56160.
$> docker-compose ps
Name Command State Ports
------------------------------------------------------------
pong-client python3 client.py Up
pong-server python3 server.py Up 0.0.0.0:42->42/tcp
Formation Docker
7-2
Formation Docker
8
Formation Docker
9
Formation Docker
10-1
Créer un service bundle répondant à ces différents critères :
Formation Docker
10-2
By Baptiste MOINE
Formation sur Docker
#SysAdmin driven by curiosity ~ #InfoSec involved student ~ Keen interest in team-based security challenges ~ 0x860B5424