Quick Guide to Docker

Posted by:

|

On:

|

,

What is Docker?

Docker is a platform that enables developers to build, deploy and manage containers – which are lightweight, portable units that package an application and it’s dependencies, ensuring consistency across various environments.

Key Concepts

Image: A read-only template defining your applications and it’s environment, including variables and mapped drives.

Container: A runnable instance of an image, encapsulating an application, where encapsulation refers to bundling an application and all it’s dependencies into a self-contained image.

Dockerfile: A script containing instructions to assemble a Docker image.

Docker Hub: A cloud-based registry for sharing Docker images.

Basic Commands

docker pull <image>: Download an image from Docker Hub or a Private Registry.

docker run <image>: Create and start a container from an imagine, usually chained with parameters for port numbers, etc.

docker ps: List running containers.

docker stop <container>: Stop a running container, using either the image name or the container id.

docker rm <container>: Removes a container.

Why Use Docker?

Consistency: Ensuring applications run the same in development and production.

Isolation: Separates applications for security and resource management, similar to other forms of Virtualization.

Portability: Run applications seamlessly across different systems.

Efficiency: Lightweight containers use fewer resources than traditional virtual machines.

Getting Started

Install Docker: Download and install Docker Desktop from docker.com.

Run a Test Container:

docker run hello-world

This commands downloads the “hello-world” image and runs it as a container after verification of your installation.

How do I use Docker?

I use Docker on the daily for my job as a Software Engineer, many times I am using a database in Docker for testing things locally or I am packaging up changes for my SaaS projects and even simple productivity apps that I have created to enhance my daily workflows such as TODO lists, etc. How do you use Docker? In my next post, I’ll dive in Docker-compose and creating a.yaml for using PostgreSQL and PGAdmin4 all with Docker.