Docker: Installation, Configuration, and Getting Started

1. Introduction

Docker is a platform for developing, delivering, and running containerized applications.
In this guide, we’ll walk through installing Docker and Docker Compose on Ubuntu, performing basic configuration, and running your first commands.

2. Installing Docker and Docker Compose on Ubuntu

sudo apt update
sudo apt install -y ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo tee /etc/apt/keyrings/docker.asc > /dev/null
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

3. Installing Docker Compose

Docker Compose is already included in the docker-compose-plugin package,
but if you need a standalone version, run:

sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Check the version:

docker-compose --version

4. Verifying the Installation

After installation, make sure Docker is working:

docker --version
docker run hello-world

If the hello-world container runs successfully, Docker is installed and running correctly.

5. Configuring Docker

5.1. Start and Enable Docker on Boot

sudo systemctl enable --now docker

Check the status:

sudo systemctl status docker

5.2. Running Docker Without sudo

To run Docker without sudo, add your current user to the docker group:

sudo usermod -aG docker $USER
newgrp docker

6. Basic Docker Commands

  • docker ps — list running containers.
  • docker ps -a — list all containers.
  • docker images — list downloaded images.
  • docker run -d -p 80:80 nginx — run an Nginx container.
  • docker stop <container_id> — stop a container.
  • docker rm <container_id> — remove a container.
  • docker rmi <image_id> — remove an image.

7. Conclusion

You’ve installed Docker and Docker Compose, configured them, and executed your first commands.
In the next part, we’ll explore creating custom images and working with a Dockerfile.

🚀 Explore more guides on our blog 👉 blog.1it.pro
📧 Contact us: admin@1it.pro for expert IT guidance.
🌐 Explore more: Visit 1it.pro for top-tier IT solutions.

UA EN RU

Зв'язатися з нами

Telegram Email