Simplifier l'orchestration d'applications
=> Simplifie la vie des devs et des ops !
Source : https://blog.docker.com/2016/03/containers-are-not-vms/
Architecture
layer ?
image ? (~classe)
container ? (~objet)
cat centos6-base.tar | docker import - centos6-base
Dockerfile : Description d'une image
FROM BASEIMAGE:VERSION
MAINTAINER Thales.COM "USER@THALES.COM"
ENV MYVAR=”VALUE”
RUN YUM INSTALL PKGS1 , PKGS2 -Y
RUN MKDIR -P /WORKDIR/LOG
COPY ./CONF/APPLICATION.CONF /WORKDIR/APP.CONF
ADD WWW.ARCHIVE.COM/MYARCHIVE.TAR.GZ /WORKDIR/
EXPOSE 9000
VOLUME [“/WORKDIR/LOG”]
WORKDIR [“/WORKDIR”]
USER MYUSER
ENTRYPOINT [“/BIN/BASH”]
CMD [“ECHO” , “HELLO WORLD”]
Dockerfile
Exécution d'un conteneur :
FROM tomcat:8.0.32-jre8
MAINTAINER Guillaume Dupin "guillaume.dupin.external@irt-saintexupery.com"
COPY server.xml /usr/local/tomcat/conf/
COPY target/webapp.war /usr/local/tomcat/webapps/
# CMD ["service","tomcat","start"]
$> docker build -t montomcatamoi -f /path/to/Dockerfile
$> docker run -d [options] montomcatamoi
(gestion de conteneurs en multi-machines)
docker run ... <image>
docker service create --replicas=N <image>
docker service scale my-svc=10
$ docker-compose up -d
docker-compose.yaml
docker stack deploy -f docker-compose.yml my_stack
Coding Dojo : Venez nombreux !
Questions ?