Speaker : Benoit Tellier
Retrieve this presentation online : https://rawgit.com/Open-Up/openup02_06/master/presentation/index.html
And on GitHub
Container
Packaging applications
Uses LXC and cgroups
Proposes a high level API
docker ps
docker ps -a
docker rm container
docker images
docker rmi image
docker run image
docker run --port "80:8080" image
docker run --link "dnsEntryUsed:linkedContainerName" image
docker run --volume "onMyComputer:inTheContainer" image
docker run --name "containerName" image
docker inspect container
# !!!! Should not modify the state of the container !!!!
docker exec container command
Declarative file to build docker images
One line defines one intermediate image
FROM
specifies origin image
Exemple : FROM java:openjdk-8-jdk
ENV
defines environment variables
Exemple : ENV GIT_VERSION 1:2.1.4-2.1
WORKDIR
Changes of directory
Exemple : WORKDIR /root
RUN
Run a command inside the container
Exemple : RUN apt-get install -y git
COPY
Copy files into the container
Example : COPY compile.sh /root/compile.sh
ENTRYPOINT
Defines the command to execute when starting the container
Exemple : ENTRYPOINT ["/root/compile.sh"]
FROM java:openjdk-8-jdk
ENV GIT_VERSION 1:2.1.4-2.1
# Install Maven
WORKDIR /root
RUN wget http://mirrors.ircam.fr/pub/apache/maven/maven-3/3.3.1/binaries/apache-maven-3.3.1-bin.tar.gz
RUN tar -xvf apache-maven-3.3.1-bin.tar.gz
RUN ln -s /root/apache-maven-3.3.1/bin/mvn /usr/bin/mvn
# Install git
RUN apt-get update
RUN apt-get install -y git
# Copy the script
COPY compile.sh /root/compile.sh
COPY integration_tests.sh /root/integration_tests.sh
# Define the entrypoint
WORKDIR /james-project
ENTRYPOINT ["/root/compile.sh"]
docker build
docker build --tag "tag"
docker build path/to/dockerfile
apt-get install apache2
/etc/init.d/apache2 start / stop / reload
Apache project page/etc/apache2/apache2.conf
# /etc/apache2/
# |-- apache2.conf
# | `-- ports.conf
# |-- mods-enabled
# | |-- *.load
# | `-- *.conf
# |-- conf-enabled
# | `-- *.conf
# `-- sites-enabled
# `-- *.conf
Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
Options FollowSymLinks
AllowOverride None
Require all denied
AllowOverride None
Require all granted
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
AccessFileName .htaccess
Require all denied
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf
# apachectl configtest
Syntax OK
# apachectl restart
# apachectl graceful
AuthType Basic
AuthName "Authentification obligatoire"
AuthUserFile /path/access/passwd
Require valid-user
$ htpasswd -c passwd identifier
$ htpasswd passwd identifier
Require valid-user
Order allow,deny
Allow from 198.51.100.0/24
Satisfy Any
ServerAdmin webmaster@localhost
ServerName weathermap-editor.minet.net
ServerAlias weathermap-editor
DocumentRoot /var/www/weathermap.minet.net
Options FollowSymLinks
AllowOverride None
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride all
Order allow,deny
allow from all
AuthType Basic
AuthName "Intranet MiNET"
AuthBasicProvider ldap
#AuthzLDAPAuthoritative off
AuthLDAPUrl ldap://ldap/ou=equipe,dc=minet,dc=net?uid
AuthLDAPBindDN "cn=Apache,ou=auths,ou=systems,ou=equipe,dc=minet,dc=net"
AuthLDAPBindPassword "egfuzeivkzeuf"
Require valid-user
ErrorLog ${APACHE_LOG_DIR}/weathermap-editor-error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/weathermap-editor-access.log combined