Aller au contenu

Installation de Docker

installation-docker
Voici la méthode la plus rapide et la plus simple pour installer docker et docker compose.

Installation rapide Docker

Pour utiliser le script d’installation de Docker officiel , utiliser ces commandes :
wget https://get.docker.com/
chmod +x index.html
mv index.html docker.sh
./docker.sh

Installation rapide Docker-Compose

Pour utiliser le script d’installation de Docker-Compose officiel , utiliser cette commandes :
apt install docker-compose

Installation de Docker depuis la source

Pour installer docker depuis la source, lancez ces commandes :
sudo apt-get install ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null 
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo apt-cache madison docker-ce
sudo apt-get install docker-ce=5:20.10.18~3-0~debian-bullseye docker-ce-cli=5:20.10.18~3-0~debian-bullseye containerd.io docker-compose-plugin

Installation de Docker-Compose depuis la source

Pour installer docker-compose depuis la source, lancez ces commandes :
curl -L https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

Test de Docker

docker run hello-world
Si l’installation de Docker est fonctionnelle, la console renverra ceci :
λ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:aa0cc8055b82dc2509bed2e19b275c8f463506616377219d9642221ab53cf9fe
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/