1. 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
Display Docker version#
docker -v
Enable Docker to start on boot#
systemctl enable docker
2. Install Docker-Compose#
Check the latest version of Compose#
Tags · docker/compose (github.com)
Replace download/v2.17.3/docker-compose with the latest version
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
Display Compose version#
docker-compose --version
Uninstall Docker#
sudo apt-get purge docker-ce docker-ce-cli containerd.io
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 |