Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

What is Docker Images?

  • Difficulty Level : Basic
  • Last Updated : 13 Oct, 2021

A Docker Image is an executable package of software that includes everything needed to run an application. This image informs how a container should instantiate, determining which software components will run and how.
 Docker Container: It is a virtual environment that bundles application code with all the dependencies required to run the application. The application runs quickly and reliably from one computing environment to another.

Running Instances from DockerFile

Running Containers from Docker Image:

Follow the below steps to create a Docker Image and run a Container:

Step 1: Create a Dockerfile.

Step 2: Run the following command in the terminal and it will create a docker image of the application and download all the necessary dependencies needed for the application to run successfully.

docker build -t <name to give to your image>

This will start building the image.

Step 3:  We have successfully created a Dockerfile and a respective Docker image for the same.

Step 4: Run the following command in the terminal and it will create a running container with all the needed dependencies and start the application.

docker run -p 9000:80 <name to give to your container>

The 9000 is the port we want to access our application on. 80 is the port the container is exposing for the host to access.

Useful Docker Image commands:

  • Starting an Image:
docker start <id-of-image>
  • Stop a running Image:
docker stop <id-of-image>
  • Remove an Image from Docker:
docker rmi <id-of-image>
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!