This is an old revision of the document!
installation de docker desktop sur Linux
d'abord une mise a jour des repos
root@debL74:~# apt-get update
retrait d'eventuels anciennes installations docker deprecated
root@debL74:~# for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
# keys root@debL74:~# apt-get install ca-certificates curl root@debL74:~# curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc root@debL74:~# chmod a+r /etc/apt/keyrings/docker.asc # apt repo root@debL74:~# echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null root@debL74:~# cat /etc/apt/sources.list.d/docker.list deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian bookworm stable root@debL74:~# apt-get update
root@debL74~# apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin root@debL74-14212:~# uname -a Linux debL74-14212 6.1.0-28-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.119-1 (2024-11-22) x86_64 GNU/Linux root@debL74-14212:~# apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin Lecture des listes de paquets... Fait Construction de l'arbre des dépendances... Fait Lecture des informations d'état... Fait Les paquets supplémentaires suivants seront installés : docker-ce-rootless-extras pigz slirp4netns Paquets suggérés : aufs-tools cgroupfs-mount | cgroup-lite Les NOUVEAUX paquets suivants seront installés : containerd.io docker-buildx-plugin docker-ce docker-ce-cli docker-ce-rootless-extras docker-compose-plugin pigz slirp4netns 0 mis à jour, 8 nouvellement installés, 0 à enlever et 3 non mis à jour. Il est nécessaire de prendre 123 Mo dans les archives. Après cette opération, 441 Mo d'espace disque supplémentaires seront utilisés. Souhaitez-vous continuer ? [O/n]
root@debL74# docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world c1ec31eb5944: Pull complete Digest: sha256:305243c734571da2d100c8c8b3c3167a098cab6049c9a5b066b6021a60fcb966 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly.
root@debL74# service docker status ● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; preset: enabled) Active: active (running) since Sat 2024-12-07 23:03:23 CET; 3min 25s ago TriggeredBy: ● docker.socket Docs: https://docs.docker.com Main PID: 939669 (dockerd) Tasks: 14 Memory: 31.2M CPU: 598ms CGroup: /system.slice/docker.service └─939669 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
root@debL74# systemctl status containerd.service ● containerd.service - containerd container runtime Loaded: loaded (/lib/systemd/system/containerd.service; enabled; preset: enabled) Active: active (running) since Sat 2024-12-07 23:03:21 CET; 21min ago Docs: https://containerd.io Main PID: 939538 (containerd) Tasks: 13 Memory: 62.1M CPU: 1.955s CGroup: /system.slice/containerd.service └─939538 /usr/bin/containerd root@debL74# docker compose version Docker Compose version v2.29.7
pour qu'une utilisateur non privilegier puisse lancer des CT docker il faut qu'il ai des privileges qu'il acquiere en appartenant au groupe docker, root le promote dans ce groupe
root@debL74# usermod -aG docker jehan
le user rafraichit son environement
jehan@debL74$ su - jehan jehan@debL74$ id uid=1005(jehan) gid=1005(jehan) groupes=1005(jehan),100(users),994(docker)
jehan@debL74$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES jehan@debL74$ docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE hello-world latest d2c94e258dcb 19 months ago 13.3kB jehan@debL74$ docker run hello-world Hello from Docker!
rechercher une distribution linux
jehan@debL74$ docker search almalinux NAME DESCRIPTION STARS OFFICIAL almalinux/almalinux DEPRECATION NOTICE: This image is deprecated… 9 almalinux The official build of AlmaLinux OS. 176 [OK] almalinux/8-base AlmaLinux OS 8 official base image 1 almalinux/9-base AlmaLinux 9 Base container image 0 ... <code> recuperation de la distribution Linux <code> jehan@debL74-14212:~$ docker pull ubuntu Using default tag: latest latest: Pulling from library/ubuntu de44b265507a: Pull complete Digest: sha256:80dd3c3b9c6cecb9f1667e9290b3bc61b78c2678c02cbdae5f0fea92cc6734ab Status: Downloaded newer image for ubuntu:latest docker.io/library/ubuntu:latest
jehan@debL74$ docker image list REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu latest b1d9df8ab815 2 weeks ago 78.1MB hello-world latest d2c94e258dcb 19 months ago 13.3kB jehan@debL74$ docker inspect --format='{{json .RootFS}}' b1d9df8ab815 | jq { "Type": "layers", "Layers": [ "sha256:687d50f2f6a697da02e05f2b2b9cb05c1d551f37c404ebe55fdec44b0ae8aa5c" ] }
jehan@debL74$ docker info | grep -i "Storage Driver" Storage Driver: overlay2 jehan@debL74$ docker info | grep "Root Dir" WARNING: bridge-nf-call-iptables is disabled Docker Root Dir: /var/lib/docker
root@debL74-14212:~# du -sm /var/lib/docker/overlay2/df3026f153ed2fb49308f8124adf41b81dcc48384a1497a28ff445bffbd89782/* 84 /var/lib/docker/overlay2/df3026f153ed2fb49308f8124adf41b81dcc48384a1497a28ff445bffbd89782/diff 1 /var/lib/docker/overlay2/df3026f153ed2fb49308f8124adf41b81dcc48384a1497a28ff445bffbd89782/link
pour lancer notre image ubuntu et en instancier un container (CT) avec un shell interactif oouvert :
jehan@debL74$ docker run -it ubuntu root@c3b25bd7fa19:/# cat /etc/os-release PRETTY_NAME="Ubuntu 24.04.1 LTS" NAME="Ubuntu" VERSION_ID="24.04" VERSION="24.04.1 LTS (Noble Numbat)"