Install Docker
Using Debian as an example
Update packages and install wget and vim tools
apt-get update && apt-get install -y wget vim
Download and install Docker
wget -qO- get.docker.com | bash
Show Docker version
docker -v
Enable Docker to start on boot
systemctl enable docker
Install Docker-Compose
Check the latest version of Compose
Tags · docker/compose (github.com)
Replace <span style="color:red">v2.17.3</span>
with the desired version number in the following command:
sudo curl -L "https://github.com/docker/compose/releases/download/v2.17.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Make it executable
sudo chmod +x /usr/local/bin/docker-compose
Show Compose version
docker-compose --version
Uninstall Docker
sudo apt-get purge docker-ce docker-ce-cli containerd.io
Remove Docker files
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
Common Docker commands
Command | Description |
---|---|
docker run | Run a container |
docker build | Build an image |
docker pull | Pull an image |
docker push | Push an image to a repository |
docker images | List all local images |
docker ps | List running containers |
docker stop | Stop one or more containers |
docker rm | Remove one or more containers |
docker rmi | Remove one or more images |
docker exec | Execute a command in a container |