tech:notes_docker
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:notes_docker [2025/10/09 17:29] – Jean-Baptiste | tech:notes_docker [2026/05/31 02:12] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Notes Docker | ||
| + | |||
| + | Voir : | ||
| + | * `namespace.unpriv_enable=1` | ||
| + | * [[Scan de vulnérabilité pour les images de conteneurs]] | ||
| + | |||
| + | Voir aussi OpenContainers : | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | A lire : | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * http:// | ||
| + | * https:// | ||
| + | |||
| + | Django: Mise en place de l’HTTPS via Nginx | ||
| + | * https:// | ||
| + | |||
| + | Mise en production de Django via Docker | ||
| + | * https:// | ||
| + | |||
| + | Docker et sécurité : | ||
| + | * https:// | ||
| + | |||
| + | |||
| + | Autre : | ||
| + | * https:// | ||
| + | |||
| + | |||
| + | ## Trouver et activer les bons dépôts | ||
| + | |||
| + | https:// | ||
| + | |||
| + | | **App** | ||
| + | | ------------ | ---------------------------- | | ||
| + | | Système OS | rhel-7-server-rpms | ||
| + | | Docker | ||
| + | | PHP-FPM | ||
| + | |||
| + | |||
| + | ## Install | ||
| + | |||
| + | ### Prérequis | ||
| + | |||
| + | Vérifier les prérequis : | ||
| + | # https:// | ||
| + | https:// | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ### Debian | ||
| + | |||
| + | `/ | ||
| + | ~~~bash | ||
| + | GRUB_CMDLINE_LINUX=" | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | update-grub | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### RedHat | ||
| + | |||
| + | ~~~bash | ||
| + | #grubby --args=" | ||
| + | #grubby --args=" | ||
| + | grubby --args=" | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | Install paquets | ||
| + | ~~~bash | ||
| + | yum install docker-latest #docker # | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Si conf proxy Docker et SystemD | ||
| + | |||
| + | Voir https:// | ||
| + | |||
| + | ~~~bash | ||
| + | mkdir / | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ini | ||
| + | [Service] | ||
| + | # Environment = " | ||
| + | Environment = " | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | #systemctl restart docker | ||
| + | #systemctl enable docker | ||
| + | systemctl daemon-reload | ||
| + | systemctl restart docker-latest | ||
| + | systemctl enable docker-latest | ||
| + | ~~~ | ||
| + | |||
| + | Vérif | ||
| + | |||
| + | ~~~bash | ||
| + | systemctl show --property=Environment docker-latest | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Sécurité | ||
| + | |||
| + | Voir : | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | |||
| + | ### Droits pour utilisateur non root | ||
| + | |||
| + | |||
| + | |||
| + | **¡¡¡ Attention, grosse faille de sécu !!!** | ||
| + | |||
| + | ~~~bash | ||
| + | docker run -ti --privileged -v /:/host debian chroot /host | ||
| + | docker run -ti --userns=host --privileged -v /:/host debian chroot /host | ||
| + | |||
| + | #List images to use one | ||
| + | docker images | ||
| + | #Run the image mounting the host disk and chroot on it | ||
| + | docker run -it -v /:/host/ ubuntu: | ||
| + | |||
| + | # Get full access to the host via ns pid and nsenter cli | ||
| + | docker run -it --rm --pid=host --privileged ubuntu bash | ||
| + | nsenter --target 1 --mount --uts --ipc --net --pid -- bash | ||
| + | |||
| + | # Get full privs in container without --privileged | ||
| + | docker run -it -v /:/host/ --cap-add=ALL --security-opt apparmor=unconfined --security-opt seccomp=unconfined --security-opt label: | ||
| + | ~~~ | ||
| + | |||
| + | Voir : | ||
| + | * `--security-opt apparmor=unconfined` | ||
| + | * `--security-opt seccomp=unconfined` | ||
| + | * `--security-opt label: | ||
| + | |||
| + | |||
| + | Voir : http:// | ||
| + | |||
| + | ~~~bash | ||
| + | ls -l / | ||
| + | groupadd docker | ||
| + | usermod -aG docker process | ||
| + | #chgrp docker / | ||
| + | #systemctl restart docker | ||
| + | systemctl restart docker-latest | ||
| + | ~~~ | ||
| + | |||
| + | Voir : | ||
| + | * Podman | ||
| + | * kata-containers | ||
| + | |||
| + | |||
| + | ### Droits montage | ||
| + | |||
| + | ~~~bash | ||
| + | docker run -v / | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | doesn' | ||
| + | Submounts like / | ||
| + | |||
| + | |||
| + | #### Autres - seccomp | ||
| + | |||
| + | https:// | ||
| + | |||
| + | ~~~bash | ||
| + | docker run --rm -it --security-opt seccomp=unconfined debian: | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Espace de nom (namespace) | ||
| + | |||
| + | |||
| + | |||
| + | ** Le fichier `/ | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | # | ||
| + | ~~~ | ||
| + | |||
| + | A la place (** Attention, a vérifier, fichier crée sur une Debian**) | ||
| + | |||
| + | Pour activer le namespace | ||
| + | |||
| + | `" | ||
| + | |||
| + | ~~~bash | ||
| + | sysctl -w kernel.unprivileged_userns_clone=1 | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~javascript | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | ] | ||
| + | } | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | Voir : | ||
| + | ~~~bash | ||
| + | man dockerd | ||
| + | docker daemon --help | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | systemctl daemon-reload | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | ## Stockage | ||
| + | |||
| + | Info : | ||
| + | ~~~bash | ||
| + | docker info | grep "Data Space" | ||
| + | ~~~ | ||
| + | |||
| + | device-mapper-driver | ||
| + | ~~~bash | ||
| + | lvcreate -y -l 1%FREE -n docker0meta vgos | ||
| + | lvcreate -y -l 95%FREE -n docker0 vgos | ||
| + | lvconvert -y \ | ||
| + | --zero n \ | ||
| + | -c 512K \ | ||
| + | --thinpool vgos/ | ||
| + | --poolmetadata vgos/ | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | mkdir / | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~c | ||
| + | activation { | ||
| + | thin_pool_autoextend_threshold=80 | ||
| + | thin_pool_autoextend_percent=20 | ||
| + | } | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | lvchange --metadataprofile docker-thinpool vgos/ | ||
| + | |||
| + | lvs -o+seg_monitor | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | Pour identifier les conteneurs utilisant un volume spécifique | ||
| + | ~~~bash | ||
| + | docker ps -a --filter volume=data-nfs3 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Notes RedHat | ||
| + | |||
| + | `/ | ||
| + | |||
| + | The Docker config is `--storage-driver=devicemapper --storage-opt dm.thinpooldev=/ | ||
| + | |||
| + | ~~~bash | ||
| + | docker-storage-setup | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | # | ||
| + | DOCKER_STORAGE_OPTIONS=" | ||
| + | ~~~ | ||
| + | |||
| + | Voir aussi : | ||
| + | * / | ||
| + | |||
| + | |||
| + | ### Debian | ||
| + | |||
| + | https:// | ||
| + | |||
| + | ~~~bash | ||
| + | apt-get install thin-provisioning-tools | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### RedHat 7 | ||
| + | |||
| + | docker-latest | ||
| + | à la 1ere install | ||
| + | |||
| + | `/ | ||
| + | ~~~ini | ||
| + | # This file may be automatically generated by an installation program. | ||
| + | |||
| + | # By default, Docker uses a loopback-mounted sparse file in | ||
| + | # / | ||
| + | # restrictive defaults, such as 100GB max storage. | ||
| + | |||
| + | # If your installation did not set a custom storage for Docker, you | ||
| + | # may do it below. | ||
| + | |||
| + | # Example: Use a custom pair of raw logical volumes (one for metadata, | ||
| + | # one for data). | ||
| + | # DOCKER_STORAGE_OPTIONS = --storage-opt dm.metadatadev=/ | ||
| + | |||
| + | DOCKER_STORAGE_OPTIONS= | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Réseau | ||
| + | |||
| + | ### List Docker Container Names and IPs | ||
| + | |||
| + | ~~~bash | ||
| + | function drips(){ | ||
| + | docker ps -q | xargs -n 1 docker inspect --format '{{ .NetworkSettings.IPAddress }} {{ .Name }}' | sed 's/ \// /' | ||
| + | } | ||
| + | ~~~ | ||
| + | |||
| + | Source : https:// | ||
| + | |||
| + | |||
| + | ### /etc/hosts | ||
| + | |||
| + | Default gateway \\ | ||
| + | Le hôte du container est indiqué par `host.containers.internal` (podman) | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | 127.0.0.1 | ||
| + | ::1 | ||
| + | 10.246.223.27 | ||
| + | 10.88.0.1 | ||
| + | 10.88.0.176 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | ### Conf Default bridge VLAN | ||
| + | |||
| + | |||
| + | `/ | ||
| + | ~~~javascript | ||
| + | { | ||
| + | " | ||
| + | } | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Vérif | ||
| + | |||
| + | ~~~bash | ||
| + | docker info | grep -i warn | ||
| + | |||
| + | systemctl status docker | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Import / Export images Docker | ||
| + | |||
| + | Enregistrer / Sauvegarder l' | ||
| + | |||
| + | ~~~bash | ||
| + | docker save -o <save image to path> <image name> | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | Importer l' | ||
| + | ~~~bash | ||
| + | docker load -i <path to image tar file> | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Debug | ||
| + | |||
| + | Test | ||
| + | ~~~bash | ||
| + | docker run --rm hello-world | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | #systemctl stop docker | ||
| + | systemctl stop docker-latest ; rm -rf / | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Autres | ||
| + | |||
| + | Dépôt (Docker Registry) | ||
| + | * https:// | ||
| + | |||
| + | |||
| + | ### Architecture x86 amd64 arm | ||
| + | |||
| + | ~~~bash | ||
| + | docker run --platform linux/amd64 --publish 8000:8080 ghcr.io/ | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Notes brouillon | ||
| + | |||
| + | #### Namespace | ||
| + | |||
| + | Voir : | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * `/ | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | dockremap: | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | dockremap: | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Perf strest test pour prod | ||
| + | |||
| + | https:// | ||
| + | |||
| + | |||
| + | ## Pb | ||
| + | |||
| + | ~~~bash | ||
| + | docker run --rm hello-world | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ~~~ | ||
| + | nsenter: unable to unshare namespaces: Invalid argument | ||
| + | container_linux.go: | ||
| + | / | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | -------- | ||
| + | |||
| + | # Notes Docker old | ||
| + | |||
| + | Note sécurité : | ||
| + | * http:// | ||
| + | |||
| + | Voir : | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * https:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | |||
| + | Docker avec tous les services (ssh, cron, initlike) | ||
| + | * http:// | ||
| + | |||
| + | Nginx reverse proxy pour Docker | ||
| + | * https:// | ||
| + | |||
| + | ** Pb de sécurité | ||
| + | ~~~bash | ||
| + | docker run -ti --privileged -v /:/host fedora chroot /host | ||
| + | ~~~ | ||
| + | Voir http:// | ||
| + | |||
| + | |||
| + | Voir aussi | ||
| + | ~~~ | ||
| + | Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning. | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ~~~ | ||
| + | # docker -d | ||
| + | INFO[0000] Listening for HTTP on unix (/ | ||
| + | INFO[0000] [graphdriver] using prior storage driver " | ||
| + | WARN[0000] Your kernel does not support cgroup memory limit: mountpoint for memory not found | ||
| + | WARN[0000] mountpoint for cpu not found | ||
| + | FATA[0000] Error mounting devices cgroup: mountpoint for devices not found | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Proxy | ||
| + | |||
| + | ~~~bash | ||
| + | export ALL_PROXY=" | ||
| + | ~~~ | ||
| + | |||
| + | ### Construire un Docker avec un Dockerfile | ||
| + | |||
| + | ~~~bash | ||
| + | cd MonDossierQuiContientUnDockerfile | ||
| + | docker build -t mondocker . | ||
| + | ~~~ | ||
| + | |||
| + | Exemple de commandes | ||
| + | ~~~bash | ||
| + | docker pull debian | ||
| + | docker images | ||
| + | docker images -q | ||
| + | docker info | ||
| + | docker version | ||
| + | docker ps -a | ||
| + | docker ps -q -n 1 | ||
| + | docker ps -f name=etherpad1 | ||
| + | docker logs --tail 0 -f < | ||
| + | docker run -ti -p 53:53 -p 53:53/udp --name bind debian /bin/bash | ||
| + | docker ps | ||
| + | docker exec -it a6cc3efa1aa1 /bin/bash | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | cat context.tar | docker build - | ||
| + | run builder_image | docker build - | ||
| + | |||
| + | docker run -v /:/my_host ubuntu:ro ls /my_host | ||
| + | |||
| + | docker port | ||
| + | |||
| + | docker inspect | ||
| + | ~~~ | ||
| + | |||
| + | Connaître le " | ||
| + | |||
| + | ~~~bash | ||
| + | #docker run -d <nom image> | ||
| + | |||
| + | JOB1=$(docker run -d conteneur) | ||
| + | docker logs $JOB1 | ||
| + | docker stop $JOB1 | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | docker pull debian | ||
| + | docker run -i -t debian /bin/bash | ||
| + | docker rm $(docker ps -q -a) | ||
| + | ~~~ | ||
| + | |||
| + | ----- | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | adduser jean docker | ||
| + | |||
| + | docker run -d -p 7777:8000 zerobin su -l www-data -c ' | ||
| + | docker run -d -p 80:80 --name my_wiki mprasil/ | ||
| + | ~~~ | ||
| + | |||
| + | Liens : | ||
| + | * https:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | |||
| + | ## Suis-je dans un conteneur (container) ? | ||
| + | |||
| + | ~~~bash | ||
| + | grep ' | ||
| + | ~~~ | ||
| + | |||
| + | ## Notes gestion des process services grâce à supervisor | ||
| + | |||
| + | ~~~bash | ||
| + | mkdir / | ||
| + | ~~~ | ||
| + | |||
| + | Liens : | ||
| + | * http:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | |||
| + | ~~~ini | ||
| + | stdout_logfile=/ | ||
| + | stderr_logfile=/ | ||
| + | numprocs=4 | ||
| + | ~~~ | ||
| + | |||
| + | ## Notes supervision | ||
| + | |||
| + | Machine de dev, commit effectué dans des images non nommé (doit être zero) | ||
| + | ~~~bash | ||
| + | docker images | sed -e ' | ||
| + | ~~~ | ||
| + | |||
| + | Logs d' | ||
| + | ~~~bash | ||
| + | grep CRIT / | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Notes DNS Bind9 | ||
| + | |||
| + | Sur l' | ||
| + | ~~~bash | ||
| + | docker run -ti -p 53:53 -p 53:53/udp --name bind debian /bin/bash | ||
| + | ~~~ | ||
| + | |||
| + | Dans le conteneur | ||
| + | ~~~bash | ||
| + | apt-get install --no-install-recommends bind9 bind9-doc bind9-host dnsutils | ||
| + | apt-get install --no-install-recommends supervisor vim file netcat tmux traceroute mtr net-tools dnsutils bind9 bind9-doc bind9utils | ||
| + | apt-get install --no-install-recommends lsb-release wget ca-certificates | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Pb | ||
| + | |||
| + | Limitation limite de mémoire `-m 512m` | ||
| + | |||
| + | ~~~bash | ||
| + | docker run -ti -m 512m --name madebian1 debian /bin/bash | ||
| + | ~~~ | ||
| + | |||
| + | Erreur | ||
| + | ~~~ | ||
| + | WARNING: Your kernel does not support memory limit capabilities. Limitation discarded. | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ini | ||
| + | GRUB_CMDLINE_LINUX=" | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | update-grub | ||
| + | ~~~ | ||
| + | |||
| + | ### Pb 2 | ||
| + | |||
| + | http:// | ||
| + | |||
| + | J'ai le même pb. | ||
| + | |||
| + | A l’arrêt de l' | ||
| + | |||
| + | Je dois faire manuellement après un reboot : | ||
| + | ~~~bash | ||
| + | docker rm $(docker -a -q) | ||
| + | ~~~ | ||
| + | |||
| + | Pour faire les choses proprement c'est à supervisord de n'en occuper | ||
| + | |||
| + | ### Pb 3 Unable to enable SKIP DNAT rule | ||
| + | |||
| + | Sur RedHat | ||
| + | |||
| + | Source : https:// | ||
| + | |||
| + | ~~~ | ||
| + | Internal Server Error (" | ||
| + | ~~~ | ||
| + | |||
| + | Solution | ||
| + | ~~~bash | ||
| + | sudo iptables -t filter -N DOCKER | ||
| + | sudo systemctl restart docker | ||
| + | ~~~ | ||
| + | |||
| + | Cela se produit quand Docker est installé quand le pare-feu (firewalld) est démarré, puis qu'il a été désactivé par la suite. | ||
| + | |||
| + | |||
| + | |||
| + | ### Autre | ||
| + | |||
| + | ~~~bash | ||
| + | docker save -o plop.tar.gz acme/jibe | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | #### Notes console TTY | ||
| + | |||
| + | https:// | ||
| + | |||
| + | Starting with docker 0.6.5, you can add -t to the docker run command, which will attach a pseudo-TTY. Then you can type Control-C to detach from the container without terminating it. | ||
| + | |||
| + | If you use -t and -i then Control-C will terminate the container. When using -i with -t then you have to use Control-P Control-Q to detach without terminating. | ||
| + | |||
| + | |||
| + | #### Notes Haute dispo / Cluster | ||
| + | |||
| + | docker swarm | ||
| + | |||
| + | #### Notes catalogue images | ||
| + | |||
| + | CentOS7 | ||
| + | ~~~bash | ||
| + | docker pull centos: | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | -------------------- | ||
| + | |||
| + | |||
| + | # Notes Docker | ||
| + | |||
| + | ~~~bash | ||
| + | #docker save acme/plop1 -o acme-plop1.tar | ||
| + | docker save acme/plop1 | pigz > acme-plop1.tar.gz | ||
| + | ~~~ | ||
| + | |||
| + | Une sorte de **top** | ||
| + | ~~~bash | ||
| + | docker stats | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | docker history IMAGES --no-trunc | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | docker top CONTAINER -o pid, | ||
| + | docker top CONTAINER | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | cat > Dockerfile <<EOF | ||
| + | FROM alpine | ||
| + | # on déclare un volume | ||
| + | VOLUME /opt/data | ||
| + | # pas la peine le de le laisser tourner | ||
| + | # les volumes sont accessibles même | ||
| + | # quand le conteneur ne tourne plus | ||
| + | CMD [" | ||
| + | EOF | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | docker build -t $USER/ | ||
| + | docker run -it -d --name data $USER/ | ||
| + | |||
| + | docker run --rm -it --volumes-from data alpine sh | ||
| + | touch / | ||
| + | exit | ||
| + | |||
| + | $ docker run --rm -it --volumes-from data alpine sh | ||
| + | ls /opt/data | ||
| + | foo | ||
| + | ~~~ | ||
| + | |||
| + | Plop | ||
| + | |||
| + | ~~~bash | ||
| + | docker run -it --volume /opt/data --name data2 busybox | ||
| + | |||
| + | docker inspect --format "{{ .Mounts }}" data2 | ||
| + | docker inspect -f '{{ .Mounts }}' my-container | ||
| + | |||
| + | |||
| + | docker volume create --name dataa | ||
| + | docker run --rm -it -v dataa:/data alpine | ||
| + | |||
| + | docker volume ls | ||
| + | docker volume rm $(docker volume ls | awk ' | ||
| + | ~~~ | ||
| + | |||
| + | Arrêter tous les containers | ||
| + | ~~~bash | ||
| + | docker stop $(docker ps | awk ' | ||
| + | ~~~ | ||
| + | |||
| + | Effacer tous les containers | ||
| + | ~~~bash | ||
| + | docker rm $(docker ps -a | awk ' | ||
| + | ~~~ | ||
| + | |||
| + | Autres | ||
| + | ~~~bash | ||
| + | docker system df | ||
| + | docker system prune | ||
| + | |||
| + | docker ps --all -q -f status=dead | ||
| + | |||
| + | alias docker_clean_images=' | ||
| + | alias docker_clean_ps=' | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Cli / API | ||
| + | |||
| + | ~~~ | ||
| + | $ docker-machine.exe env master | ||
| + | export DOCKER_TLS_VERIFY=" | ||
| + | export DOCKER_HOST=" | ||
| + | export DOCKER_CERT_PATH=" | ||
| + | export DOCKER_MACHINE_NAME=" | ||
| + | export COMPOSE_CONVERT_WINDOWS_PATHS=" | ||
| + | ~~~ | ||
| + | |||
