DEV Community

Cover image for Master Docker in Minutes: Your Ultimate Hands-On Guide to Containerization
Oluwatobiloba Akinbobola
Oluwatobiloba Akinbobola

Posted on

1

Master Docker in Minutes: Your Ultimate Hands-On Guide to Containerization

INTRODUCTION

Containerization has transformed software development, deployment, and management. Docker, a leading containerization platform, stands out for its simplicity and efficiency. This hands-on lab will guide you through the basics of Docker, empowering you to leverage containerized applications with confidence.

Lab 1: Installing Docker

  1. Install Docker:
    • Download Docker Desktop from the official website.
    • Follow the installation instructions for your operating system.
  2. Verify Installation:
    • Open a terminal or command prompt and run:
docker --version
docker-compose --version
Enter fullscreen mode Exit fullscreen mode

This confirms Docker is installed and ready to use.

Lab 2: Running Your First Container

Step 1: Get the Sample Application

  • Clone the sample application repository:
git clone https://github.com/docker/welcome-to-docker
Enter fullscreen mode Exit fullscreen mode

Image description
Alternatively, download the repository manually.

Step 2: Explore the Dockerfile
A Dockerfile defines the contents of a container. Open the Dockerfile in your project folder to understand its structure.

Step 3: Build Your First Image

  • Build the Docker image:
docker build -t welcome-to-docker .
Enter fullscreen mode Exit fullscreen mode

welcome-to-docker
The -t flag tags the image with a name (welcome-to-docker).
The . specifies the location of the Dockerfile.

Step 4: Run Your Container
1.Use Docker Desktop to run the container:
Docker Desktop

  • Go to the Images tab, select your image, and click Run. Host Port-8080 2.Set the Host Port to 8080. Host Port 8080

Step 5: View the Frontend

Access the running container via Docker Desktop or navigate to https://docs.docker.com/get-started/introduction/ in your browser.
Log
Image Containers

Step 6: Stop Your Container
Stop the container in Docker Desktop by selecting the Stop icon in the Containers tab.
Stop

Summary
This article walked you through building and running your first Docker container. You also learned how to use Docker Desktop to manage containers and images.

Reference
For more advanced use cases, explore images on Docker Hub and refer to the official Docker documentation.

Heroku

Amplify your impact where it matters most — building exceptional apps.

Leave the infrastructure headaches to us, while you focus on pushing boundaries, realizing your vision, and making a lasting impression on your users.

Get Started

Top comments (0)

Playwright CLI Flags Tutorial

5 Playwright CLI Flags That Will Transform Your Testing Workflow

  • 0:56 --last-failed
  • 2:34 --only-changed
  • 4:27 --repeat-each
  • 5:15 --forbid-only
  • 5:51 --ui --headed --workers 1

Learn how these powerful command-line options can save you time, strengthen your test suite, and streamline your Playwright testing experience. Click on any timestamp above to jump directly to that section in the tutorial!

Watch Full Video 📹ī¸

👋 Kindness is contagious

DEV is better (more customized, reading settings like dark mode etc) when you're signed in!

Okay