Docker
  • Introduction
    • What is Virtualization?
      • What is a Hypervisor?
      • Microsoft Hyper-V
    • What is Containerization?
      • What is docker?
      • What is a container image?
      • When to use containers?
      • When not to use Docker containers
  • Basics
    • ▶️Pull and run an image
      • Trivia
    • Basic docker commands
    • Container life cycle
  • Build an Image
    • ▶️Console app experiment
      • Hello-world image
    • What is a docker file?
      • Our docker file explained
    • ▶️Web app experiment
      • Create application
      • Create a docker file
      • Build an image
      • Run your image
      • Manipulating containers
  • Layers & Stages
    • Introduction
    • Image layers
    • Multistage images
Powered by GitBook
On this page
  • Pull and run an image
  • Steps
  • Congratulations, Docker Dreamers!
  1. Basics

Pull and run an image

PreviousWhen not to use Docker containersNextTrivia

Last updated 1 year ago

Pull and run an image

Here are step-by-step instructions to show how to pull a simple and small Docker image and run it as a container:

Steps

Step 1: Set up Docker

  • Make sure Docker is installed on your computer. You can download and install Docker Desktop from the official Docker website ().

Step 2: Open a Terminal or Command Prompt

  • Open a terminal or command prompt on your computer.

Step 3: Pull the Docker Image

  • In the terminal, type the following command to pull a Docker image from Docker Hub:

docker pull hello-world
  • Docker will automatically download the "hello-world" image from the official Docker Hub repository.

Step 4: Verify the Image

  • Once the image is downloaded, you can verify it by running the following command:

docker images
  • You should see the "hello-world" image listed in the output.

Step 5: Run the Docker Container

  • To run the image as a container, use the following command:

docker run hello-world
  • Docker will create a container from the "hello-world" image and execute it.

  • The container will print a "Hello from Docker!" message, confirming that everything is working correctly.

Step 6: Clean up (optional)

  • If you want to remove the container, you can use the following command:

docker rmi hello-world

Congratulations, Docker Dreamers!

"You've set sail on a container voyage, navigating the seas of technology with courage and curiosity. May your code always be bug-free, your containers forever light, and your dreams soar to new heights! Keep exploring, creating, and embracing the wonders of the digital world. Bon voyage to your limitless potential!"

▶️
https://www.docker.com/products/docker-desktop