Install Docker
In this exercise, we will install Docker and understand the most commonly used container lifecycle commands and then build an image using Dockerfile.
We can install Docker using the Docker’s apt repository, or install it manually, or use a convenient script provided by Docker. For simplicity’s sake, we will use the below method.
- Install Docker:
curl -fsSL https://get.docker.com/ | sh
- Enable Docker to start on boot:
sudo systemctl enable --now docker
- Check that the Docker service is running:
sudo systemctl status docker
- Add current user to the docker group:
sudo usermod -aG docker $USER
- Refresh shell session (by exiting & logging in again).
- Verify the Docker installation:
docker ps