docker:install_docker
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
docker:install_docker [2025/06/05 20:54] – peter | docker:install_docker [2025/06/07 16:56] (current) – peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Docker - Install Docker ====== | ====== Docker - Install Docker ====== | ||
+ | ===== Prerequisites ===== | ||
+ | |||
+ | <WRAP alert> | ||
+ | **ALERT: | ||
+ | |||
+ | * Docker is NOT compatible with **ufw**. | ||
+ | * See: https:// | ||
+ | |||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Uninstall old versions ===== | ||
+ | |||
+ | <code bash> | ||
+ | for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt remove $pkg; done | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | |||
+ | * To start with a clean installation, | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | To delete all images, containers, and volumes: | ||
+ | |||
+ | <code bash> | ||
+ | sudo rm -rf / | ||
+ | sudo rm -rf / | ||
+ | </ | ||
+ | |||
+ | Remove source list and keyrings | ||
+ | |||
+ | <code bash> | ||
+ | sudo rm / | ||
+ | sudo rm / | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | </ | ||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Set up the Docker apt repository ===== | ||
+ | |||
+ | <code bash> | ||
+ | # Add Docker' | ||
+ | sudo apt update | ||
+ | sudo apt install ca-certificates curl | ||
+ | sudo install -m 0755 -d / | ||
+ | sudo curl -fsSL https:// | ||
+ | sudo chmod a+r / | ||
+ | |||
+ | # Add the repository to Apt sources: | ||
+ | echo \ | ||
+ | "deb [arch=$(dpkg --print-architecture) signed-by=/ | ||
+ | $(. / | ||
+ | sudo tee / | ||
+ | sudo apt update | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Install the Docker packages ===== | ||
+ | |||
+ | <code bash> | ||
+ | sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE:** | ||
+ | |||
+ | * **docker-ce** - The Docker engine itself. | ||
+ | * **docker-ce-cli** - A command line tool that lets you talk to the Docker daemon. | ||
+ | * **containerd.io** - A container runtime that manages the container’s lifecycle. | ||
+ | * **docker-buildx-plugin** - This extension for Docker enhances the capabilities of building images, mainly focusing on multi-platform builds. | ||
+ | * **docker-compose-plugin** - A configuration management plugin that helps manage multi-container Docker applications using a single YAML file. | ||
+ | |||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Verify that the installation is successful ===== | ||
+ | |||
+ | <code bash> | ||
+ | sudo docker run hello-world | ||
+ | </ | ||
+ | |||
+ | returns: | ||
+ | |||
+ | < | ||
+ | Unable to find image ' | ||
+ | latest: Pulling from library/ | ||
+ | e6590344b1a5: | ||
+ | Digest: sha256: | ||
+ | Status: Downloaded newer image for hello-world: | ||
+ | |||
+ | 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 " | ||
+ | (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: | ||
+ | | ||
+ | |||
+ | For more examples and ideas, visit: | ||
+ | | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | |||
+ | * When the container runs, it prints a confirmation message and exits. | ||
+ | |||
+ | * If the command fails to run, try to restart the docker service, before rerunning this test: <code bash> | ||
+ | sudo systemctl restart docker.service | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Uninstall Docker Engine ===== | ||
+ | |||
+ | <code bash> | ||
+ | sudo apt purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras | ||
+ | </ | ||
+ | |||
+ | Then, manually remove the following two directories: | ||
+ | |||
+ | <code bash> | ||
+ | sudo rm -rf / | ||
+ | sudo rm -rf / | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== References ===== | ||
+ | |||
+ | https:// | ||
+ | |||
+ | https:// | ||
+ | |||
+ | https:// | ||
docker/install_docker.1749156852.txt.gz · Last modified: 2025/06/05 20:54 by peter