
Quick Guide to Docker: Essential Commands and Key Concepts for Developers
đ Who It Is For
This guide is designed for developers and system administrators who are already familiar with Docker and need a quick reference for essential commands. It serves as a memory aid to speed up daily work with containers.
đ Introduction to Docker
Docker is a container platform that allows running applications in an isolated and portable way. With Docker, developers can package software with all its dependencies into lightweight and efficient images, ensuring they run consistently in any environment.
đą Key Docker Components
1. Images
Docker images are read-only templates that contain the operating system, libraries, and the code needed to run an application.
2. Containers
Containers are running instances of a Docker image. They are ephemeral, meaning any changes made inside the container are lost when it stops unless data persistence is used.
3. Registries
Registries store Docker images and allow sharing them with other users. Docker Hub is the most widely used public registry.
4. Volumes
Volumes enable data persistence in Docker, separating files from containers to avoid data loss.
5. Networks
Docker networks facilitate communication between containers within the same working environment.
đ Key Differences in Docker
Dockerfile vs. Docker Compose
- Dockerfile: Defines the configuration and environment of a single container.
- Docker Compose: Allows orchestrating multiple containers defined in a single YAML file.
COPY vs. ADD in Dockerfile
COPY: Copies files from the host system to the container.ADD: Does the same asCOPY, but also allows downloading files from URLs and extracting compressed files.
Example usage in Dockerfile:
đ Ports in Docker
Docker allows mapping container ports to host system ports. Examples:
Common ports in Docker include:
- 80, 443: For web servers like Nginx or Apache.
- 3306: For MySQL databases.
- 5432: For PostgreSQL.
- 6379: For Redis.
đ Basic Docker Commands
1. Run and manage containers
2. Build and manage images
3. Manage containers
4. Volumes for data persistence
5. Networks in Docker
đ Docker Compose
Docker Compose allows defining and running multi-container Docker applications using a docker-compose.yml.
Example docker-compose.yml for an application with Nginx and PostgreSQL:
To run:
đ Base Template for a Docker Project
Example of a basic Dockerfile to start a Node.js environment:
đ Best Practices in Docker
- Avoid using
FROM node:latest,as it may cause inconsistencies with new versions. - Do not copy files directly from outdated repositories.
- Version images using tags (
tags) to avoid compatibility issues. - In
docker-compose.yml, it is no longer necessary to specify the version, as Docker Compose automatically detects the appropriate configuration. - Use multiple
FROMstatements in Dockerfile if different build and runtime environments are required (multistage builds). - Do not run processes as
rootinside the container; it is better to create a specific user. - Minimize image size by using lighter base images like
alpine. - Remove unnecessary containers, volumes, and networks with
docker system pruneto free up space.
đ Conclusion
Docker is a fundamental tool for modern development, enabling the creation of consistent and replicable environments. Mastering its commands and best practices ensures better management of containerized applications.
Ready to master Docker and optimize your development processes?
At Kranio, we have experts in containerization and DevOps who will help you implement the best Docker practices in your projects. Contact us and discover how we can improve the efficiency and scalability of your applications.â
Previous Posts

Kraneating is also about protection: the process behind our ISO 27001 certification
At the end of 2025, Kranio achieved ISO 27001 certification after implementing its Information Security Management System (ISMS). This process was not merely a compliance exercise but a strategic decision to strengthen how we design, build, and operate digital systems. In this article, we share the process, the internal changes it entailed, and the impact it has for our clients: greater control, structured risk management, and a stronger foundation to confidently scale systems.

Development Standards: The Invisible Operating System That Enables Scaling Without Burning Out the Team
Discover how development standards reduce bugs, accelerate onboarding, and enable engineering teams to scale without creating friction.
