OneBite.Dev - Coding blog in a bite size

run docker

Simple docker step by step how to run docker with explanation

Docker is a popular platform that simplifies the development, shipping, and running of applications by using containerization. This article provides a basic step-by-step guide on how to run Docker.

STEP 1: Install Docker

Before you start, make sure you have Docker installed on your operating system. You can visit https://www.docker.com/products/docker-desktop to download and install Docker. Installation instructions often vary by system, so ensure to follow the instructions based on your current operating system.

STEP 2: Check Your Docker Installation

After successfully installing Docker, check whether it’s working properly. Open your terminal and type docker --version. You should see the Docker version if it’s installed correctly.

STEP 3: Pull a Docker Image

In Docker, an image is a lightweight, standalone, executable package that includes everything needed to run a piece of software. You can either create your own Docker image or use images that have been created by others. To download an image, use the docker pull command followed by the image name. For instance, to pull the hello-world image run docker pull hello-world in your terminal.

STEP 4: Run a Docker Container

A Docker container is a runtime instance of a Docker image. To run a container from the hello-world image, use the docker run command followed by the image name. Type docker run hello-world. If successful, the Docker container will display a “Hello from Docker!” message.

STEP 5: List Docker Containers

Docker provides the docker ps command to list all the running containers. If you want to view all containers (both running and exited), use the docker ps -a command.

STEP 6: Stop Docker Containers

To stop a running container, get the container ID from the docker ps command and run docker stop, followed by the container ID. The container will stop running.

The power of Docker lies in its simplicity and functionality. You can automate deploying applications in lightweight containers to run on the host operating system. Keep practicing the steps and explore additional commands to enhance your Docker journey.

docker