Docker
Installing Docker
To install Docker, go to the official website and download Docker Desktop for your operating system:
For Linux distributions (e.g. Ubuntu):
sudo apt update
sudo apt-get install docker.io
Start the Docker service:
sudo systemctl start docker
Enable Docker to start on boot:
sudo systemctl enable docker
Add your user to the Docker group to use Docker without sudo:
sudo usermod -aG docker $USER
(then restart the shell or reopen the terminal)
After installation, you can check the version with:
docker --version
Basic Docker Commands
Download a Docker image from Docker Hub(here Ubuntu):
docker pull ubuntu
Start a new container interactively (here Ubuntu):
docker run -it ubuntu
List all running containers:
docker ps
List all containers (including stopped ones):
docker ps -a
List all installed Images:
docker images
Stop a container:
docker stop <container-id>
Remove a container:
docker rm <container-id>
Remove a Docker image:
docker rmi <image-name>