W: H: YOffset??
Related Media
Categories   /  Tags

Docker installation & docker-compose fundamentals CLI

About docker and how to install on debian command line. Further commands for output and options to control system overview, regarding composer ( docker-compose ).

 

Is Docker correctly installed?

The starting point is a Debian ^12 system. Also tested on a Raspberry Pi-4.

So, is docker installed & what's the version ?
Further information about system environment ?

 

# what container is running and what's the current state?
docker ps
# Deeper information about the current docker installation. This shows current installation paths, environment architecture and warnings
docker info

 

 

Remove bad Docker installation

Are there too many errors displayed, an installation that cannot be changed or should you simply perform a complete reset?

Deletion & reset steps …

 

# Identify which Docker package you have installed
dpkg -l | grep -i docker
#Remove the packages
sudo apt-get purge -y docker-ce docker-ce-cli
sudo apt-get autoremove -y --purge docker-ce docker-ce-cli

 

If you have more docker packages installed, you can add those packages names to the end of the commands above.
For example:

 

sudo apt-get purge -y docker-engine docker docker.io docker-ce docker-ce-cli
sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce 

 

Remove all the Docker related files

 

sudo rm -rf /var/lib/docker /etc/docker
sudo rm /etc/apparmor.d/docker
sudo groupdel docker
sudo rm -rf /var/run/docker.sock

 

Create new Docker installation

Install from zero and overwrite previous settings

 


# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] download.docker.com/linux/debian \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

 

Next - install the latest version and run…

 

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

 

Test the configuration by running the hello-world image:
Note: This is an real image on hub.docker.com. 
A name like 'hellow-world-123xyz' which is not present in your sources or online - outputs an error.

 

sudo docker run hello-world

 

Should returns a message like:

 

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
478afc919002: Pull complete 
Digest: sha256:53641cd209a4fecfc68e21a99871ce8c6920b2e7502df0a20671c6fccc73a7c6
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
…

 

Some commands for a short overview about active state & the main config 

 


systemctl start docker
# Um einen Docker-Dienst neu zu starten, führe den folgenden Befehl aus:
systemctl restart docker
# Um einen Docker-Dienst anzuhalten, führe den folgenden Befehl aus:
systemctl stop docker
#Um den Docker-Dienst beim Neustart des Systems zu starten, führe folgenden Befehl aus:
systemctl enable docker
#Um den Docker-Status zu überprüfen, führe den folgenden Befehl aus:
systemctl status docker

 

 

Installing Docker-compose ( prepared for Raspberry PI )

The sources are placed on github, not sure if Debian 12 comes out with own sources. Anyway, this is an solution stable running e.g. on Raspberry Pi 4 which worked for me.

Download from:
https://github.com/docker/compose/releases
… for Raspberry PI check the file and it's direct link named something like ‘docker-composer-linux-armv7