Sauvegarde d’une image docker

Sauvegarde d’une image docker.

1) Vérfication de /tmp :

[root@framboisepi ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        15G  2.2G   12G  16% /
devtmpfs         85M     0   85M   0% /dev
tmpfs            93M     0   93M   0% /dev/shm
tmpfs            93M  436K   92M   1% /run
tmpfs            93M     0   93M   0% /sys/fs/cgroup
tmpfs            93M     0   93M   0% /tmp
/dev/mmcblk0p1   90M   25M   66M  28% /boot
tmpfs            19M     0   19M   0% /run/user/0

2) Activation du forwardin ipv4 :

[root@framboisepi ~]# sysctl -w net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1

3) Lancement de docker en tâche de fond :

[root@framboisepi ~]# docker -d &
[1] 640
[root@framboisepi ~]# 2014/06/10 18:08:01 docker daemon: 0.11.1 fb99f99-dirty; execdriver: native; graphdriver:
[12da86f2] +job initserver()
[12da86f2.initserver()] Creating server
[12da86f2] +job serveapi(unix:///var/run/docker.sock)
2014/06/10 18:08:01 Listening for HTTP on unix (/var/run/docker.sock)
[12da86f2] +job init_networkdriver()
[12da86f2] -job init_networkdriver() = OK (0)
Loading containers: ..................: done.
[12da86f2.initserver()] Creating pidfile
[12da86f2.initserver()] Setting up signal traps
[12da86f2] -job initserver() = OK (0)
[12da86f2] +job acceptconnections()
[12da86f2] -job acceptconnections() = OK (0)

4) Vérification des conteneurs en fonctionnement :

[root@framboisepi ~]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

5) Lancement de Tomcat :

[root@framboisepi ~]# docker run -p 8080:8080 -d tomcat
311cbc4a950ae6a1a7d6dcaa53f249e74ec4067250fc8662429fe9406f6d37ce

6) Liste des conteneurs activés :

[root@framboisepi ~]# docker ps
CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS              PORTS                    NAMES
311cbc4a950a        tomcat:latest       /opt/tomcat/bin/cata   16 seconds ago      Up 15 seconds       0.0.0.0:8080->8080/tcp   insane_brattain

7) Vérification :

[root@framboisepi ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        15G  2.3G   12G  17% /
devtmpfs         85M     0   85M   0% /dev
tmpfs            93M   76K   93M   1% /dev/shm
tmpfs            93M  532K   92M   1% /run
tmpfs            93M     0   93M   0% /sys/fs/cgroup
tmpfs            93M     0   93M   0% /tmp
/dev/mmcblk0p1   90M   25M   66M  28% /boot
tmpfs            19M     0   19M   0% /run/user/0
none             15G  2.3G   12G  17% /var/lib/docker/aufs/mnt/311cbc4a950ae6a1a7d6dcaa53f249e74ec4067250fc8662429fe9406f6d37ce

8) List des images disponibles :

[root@framboisepi ~]# docker images
REPOSITORY               TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
nekrofage/tomcat         latest              2f35ba10d086        7 days ago          455.7 MB
tomcat                   latest              36d49f79eca9        7 days ago          455.6 MB
resin/rpi-raspbian       wheezy              3ec3d58821ee        5 months ago        160.3 MB
resin/rpi-raspbian       latest              808b368c3b55        5 months ago        178.4 MB
resin/rpi-raspbian       jessie              01992f5cb20d        6 months ago        175.7 MB
resin/rpi-google-coder   latest              4328ed7a471e        6 months ago        452.6 MB

9) Test :
http://192.168.1.20:8080/slashdot/
Ou
http://192.168.1.20:8080/sample/
10) Création de /tmp :
– Création du répertoire temporaire :

[root@framboisepi ~]# mkdir -p /home/tmp
[root@framboisepi ~]# chmod -R 1777 /home/tmp/

– Configuration :
Ouvrir :

/etc/fstab

Ajouter :

/home/tmp /tmp bind defaults,rw,auto,bind 0 0

– Prise-en-compte du nouveau /tmp :

[root@framboisepi ~]# mount -a

– Vérification :

[root@framboisepi ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        15G  2.3G   12G  17% /
devtmpfs         85M     0   85M   0% /dev
tmpfs            93M     0   93M   0% /dev/shm
tmpfs            93M  404K   92M   1% /run
tmpfs            93M     0   93M   0% /sys/fs/cgroup
/dev/root        15G  2.3G   12G  17% /tmp
/dev/mmcblk0p1   90M   25M   66M  28% /boot
tmpfs            19M     0   19M   0% /run/user/0

– Liens :
http://andre.blaatschaap.be/tag/raspberry-pi/
https://debian-facile.org/topic-5102-resolu-augmenter-la-taille-de-tmp-page-1.html
11) Sauvegarder l’image : Garde l’historique de l’image.

[root@framboisepi ~]# docker save tomcat > ./raspi_tomcat.tar
[root@framboisepi ~]# ls -lh *.tar
-rw-r--r-- 1 root root 446M Jun 10 18:44 raspi_tomcat.tar

12) Automatisation du forwarding ipv4 et du lancement de docker:

[root@framboisepi ~]# echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.d/40-ip-forward.conf
[root@framboisepi ~]# systemctl enable docker.service

13) Lien :
http://tuhrig.de/flatten-a-docker-container-or-image/

Comments are closed, but trackbacks and pingbacks are open.