Skip to main content

🐳 Introduction and Docker installation

What is Docker?​

Docker is a platform that allows you to build, test, and deploy applications inside containers.
A container is a lightweight, portable, and autonomous unit that includes everything needed to run an application: code, libraries, dependencies, etc.

Containers are not virtual machines. They share the operating system kernel, which is why they are lighter.

❓ Why use Docker?​

  • Environment isolation (avoids version conflicts)
  • Portability between systems (Linux, Windows, Mac)
  • Reproducibility (same environments for development, testing, and production)
  • Ease of scaling and deploying services

Make sure you do not run containers in production without understanding their network and security configuration.

Common Docker uses​

  • Deploy services like databases, web servers, applications
  • Simulate production environments locally
  • Automate development environments
  • Run microservices in isolated containers

Basic commands to install Docker on Linux

These commands are intended for Ubuntu-based distributions.

Update existing packages

sudo apt update

Install necessary dependencies

sudo apt install apt-transport-https ca-certificates curl software-properties-common -y

Add the official Docker GPG key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker.gpg

Add the Docker repository

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install Docker

sudo apt update
sudo apt install docker-ce -y

Verify installation

docker --version

Docker usage example​

Create a MySQL container with Docker

docker run --name mysql-name -e MYSQL_ROOT_PASSWORD=password -d mysql

Docker usage activity​

Create a PostgreSQL container from the official website Docker Hub