Docker Download Image And Run

2/12/2022by admin

The docker pull command is very simple and easy to use command line tool to download Docker images. This Docker tutorial explains how to pull docker images from the Docker repository using the docker pull command.

An Azure Container. Note: To run the docker command without sudo, create the docker group and add your user. For details, see the post-installation steps for Linux. Download a TensorFlow Docker image. The official TensorFlow Docker images are located in the tensorflow/tensorflow Docker Hub repository. Image releases are tagged using the. Note: To run the docker command without sudo, create the docker group and add your user. For details, see the post-installation steps for Linux. Download a TensorFlow Docker image. The official TensorFlow Docker images are located in the tensorflow/tensorflow Docker Hub repository. Image releases are tagged using the following format. A container image represents binary data that encapsulates an application and all its software dependencies. Container images are executable software bundles that can run standalone and that make very well defined assumptions about their runtime environment. You typically create a container image of your application and push it to a registry before referring to it in a Pod This page provides. To find out more about a Docker image, run docker image inspect alpine. In the demo above, you used the docker image pull command to download the alpine image. When you executed the command docker container run hello-world, it also did a docker image pull behind the scenes to download the hello-world image. Docker Run Image as Container - Create Container From Docker Image. In this post, we are going to see how to create an image and run the image as a container and manage it. Before we proceed further, it is indispensable, that we are aware of what is an Image and What is a Container. So let us begin from there.

Before downloading images, you need to know the name of the image. You can find images using the docker search command:

Once you figure out which image you would like to work with, you can run the docker pull command and download the image:

For example, following command will download the Ubuntu image to the local system:

Using tags, we can download a specific version of image to our local system (you can find available tags from the docker hub). For example, if you use the latest tag, docker pull command will download the latest image:


If you don’t add a tag, the tag latest is implied.

The latest tag does not necessarily mean it will download the most recent version of the image. When the latest tag is used, docker daemon will download the image tagged as latest. For example, ubuntu:latest tag points to the 'latest LTS' release rather than the most recent release. The download will fail If the remote repository does not have an image with the latest tag.

If the -a flag is used, it will Download all tagged images in the repository.

To list available images on your local system, run the docker images command:

Note that, the docker pull is done automatically when you do a docker run command and if the image is not already present in the local system. But it is a good practice to download the image manually before starting a new container with docker run command.

Next, we are going to learn how to Start Docker Containers with docker run Command.

In this post, we are going to learn how to install a Tomcat Application Server or Web Container on Docker and Deploy web applications into the Tomcat running inside Docker. This post is all about Docker Tomcat and deploying war web application into tomcat docker, Sample Docker Tomcat image, Dockerfile for tomcat

In this Docker tomcat example, We will start with Creating a Tomcat Docker Image and Create a Docker Container from that image and Learn how to Manage the Container and Deploy our Web Application to the Tomcat running on Docker.

Steps to Build Docker Tomcat Image

  • Step1: Creating Tomcat Docker Image ( Dockerfile)
  • Step2: Build the Image
  • Step3: Publishing to Docker ( So that you can reuse the image globally)
  • Additional: How can you download and reuse this image
  • Step4: Starting the Container from the Tomcat Docker Image
  • Step5: Access the Sample Web Application Deployed already
  • Commands to Manage your Docker Tomcat Container
  • Way forward to Deploy this container to Kubernetes


We are presuming that you have all these items checked from the following CheckList

  1. Prior Knowledge of Tomcat
  2. Basic Knowledge of Docker and Container ( Refer this articles, If you want to refresh)
  3. Working Environment with Docker CE and Internet Connectivity

Step1: Creating Docker Tomcat Image – Example

First Let us start with Creating a New Directory (workspace) in which we are going to create our Dockerfile and Copy the Web Applications and other configuration files which needs to be shared with the Container.

You can also use the Existing directory but creating a new and Separate directory for your all your container projects are recommended for Clean infrastructure

Creating a Work Space Directory (or) Use the Existing one.

I have created a new directory named '/apps/docker/DockerTomcat' Along the way till the end of this article, I would refer this directory as WORKSPACE directory

Creating a DockerFile – Docker Tomcat Image

Inside the workspace, we are going to create a Dockerfile with the following content

Note*: Dockerfile must start with ‘D’ as upper case.

In the Dockerfile, I have used the tomcat download URL of my region. you can replace it with the functioning tomcat download url for your region. You can get your download link here


MAINTAINER – Who Crate and manage this container image

FROM – What is the base image, we are going to use to host our container. you can either use a minimal OS image like CentOS, Alpine or you can create your own from the scratch by mentioning SCRATCH as a value to this.

RUN – Commands to Run to make the image( the future container) in the way you want

EXPOSE Do you want your image or application in the image to expose any port to the external world or at least to the host. For example if you are building Apache HTTP server image you can EXPOSE port 80, In our case it is 8080

CMD The Default Command of the container which gets created using this image. Every Container must have a Default Command. the Container would run as long as the Default Command is running.

ADD or COPY The files you want to copy into the container from your host.

Docker download image and runes

WORKDIR Define a workspace where the upcoming (or) following set of commands/instructions should be executed in

Here you can see we have used WORKDIR twice, One is to execute set of commands on the TOMCAT_HOME/CATALINA_HOME another WORKDIR is to download the Sample Application WAR file and deploy the war into Docker Tomcat Container.

Note*: Built-In step for an Application Deployment

The Docker Container Image we are creating has an instruction to Deploy an application directly from one of our github page (download the war file) and the version of tomcat we are going to build is 8.5.40

Make necassary Changes if you opt for a different version.

Make you get the Downloadable Link of Tomcat right so that your image gets created with no issues.

Step2: Build the Docker Tomcat Image

On the same WorkSpace Directory where our Dockerfile is residing. Run the following command to build the image.

The Syntax of the Docker Image command is

Docker Download Image And Run

docker build -t [Name Of the Image] .

Here the PERIOD . (DOT) represents the Current working directory which is also part of the syntax

But why did I name my image as “saravak/tomcat8” instead of just Tomcat8

Here saravak is my Docker Login Name / Docker User Name.

It is always recommended to Name the image you are creating with your Docker User Name, So that when you are publishing the Image to Docker hub. ( A Central Shared Repository) it would be easy and People across the world can just download your image by specifying the same name that you have set.

For Example, If you want to download this image, you can simply use docker pull saravak/tomcat8 That’s all.

So when you create your images, Please make sure you use your Docker Login Name.

Step3: Publish or Push the image to DockerHub

Before you start publishing the images to DockerHub. It is necessary that you have to create your Docker Hub (or) Docker Account. Visit

Once you have set up your username in Docker Hub.

Log in to Docker Hub from the Docker CLI

Once the Login succeeded.

Publish/Push the image you have created to Docker Hub. Based on your Internet speed you can see the Upload gets completed in a couple of minutes.

Once the image is uploaded (or) Pushed, The entire world can reuse your image as we have mentioned earlier using docker pull

Additional: How to download this Docker Tomcat Image?

You can use docker CLI to download the image directly and create a container.

To Download this image Just use the following DOCKER CLI command

Once you have downloaded this image, This image would be available in your local image repository.

use either of following commands to make sure the image is present

to list all the images in your local repository use the following command

to list only the subjected tomcat image use the following command

Do I have to do Docker Pull If I want to download this image before Running it as a container?

The Answer is NO, Docker By default, would download the image from Docker Hub if the image is not available in the local image repository. So it is not necessary that you have to explicitly do the docker pull

Step4: Run Docker Tomcat image as a container.

Now the Image is ready and available in Docker Hub. Irrespective of, If the image is available locally or not. You can start the image as a container.

As mentioned earlier, Docker would search for the image in DockerHub if it is not available in local.

So the command given below can even be run at your Host from anywhere in the world. as long as you are connected to the internet. Docker would do the rest.


Docker Download Image And Runner

-it: to enable Interactive Session/SSH to get into the container at a later point in time

-d: Run the container in the background (always recommended)

--name: name your container

saravak/tomcat8: the Image used to create this container. the Image instantiated as a container

-p 8081:8080: Forwarding the Container port 8080 to Host 8081

Congratz. we started a Docker Tomcat Container

To quickly verify, if your container use docker ps command. Then at the end of this post, we will share more commands to manage your container

Step5: Access the Deployed/Built-In SampleWebApp

Since we have port forwarding and redirecting the container 8080 to the Host (mac/windows/Linux) 8081. We can access the Sample Web Application installed inside the tomcat container at the following URL


In my case, my Host machine is MAC OS so I can directly hit the URL in the browser.

Docker Commands Cheat Sheet


Deploy this Tomcat container to Kubernetes Cluster

I have written a detailed and exclusive article on how to use this image in your Kubernetes cluster and deploy this tomcat image into Kubernetes cluster as a pod/deployment.

Refer this article.

Further References:

  • Tomcat –
  • Docker –

Hope this article helps

Let me know how is this article by leaving a comment

For any help or questions contact me on comments or write me an email

Download Image For Free

Sarav AK

Follow us on Facebook or Twitter
For more practical videos and tutorials. Subscribe to our channel
Find me on Linkedin My Profile
For any Consultation or to hire us [email protected]
If you like this article. Show your Support! Buy me a Coffee.

Signup for Exclusive 'Subscriber-only' Content

Download And Run Docker Image

More from Middleware Inventory

Docker Download Image And Run Software

  • Docker SSH Into the Container - How to SSH to Container

    The Docker container is a Process and Not a Virtual Machine. So You do not need any protocol like SSH to get into the container Shell. Docker CLI has given us special commands to get into the Container like docker exec -it and docker run -it In this post, we…

  • Docker Run Image as Container - Create Container From Docker Image

    In this post, we are going to see how to create an image and run the image as a container and manage it. Before we proceed further, it is indispensable, that we are aware of what is an Image and What is a Container. So let us begin from there.…

  • How to Deploy docker image to Kubernetes

    In this post, we are going to see the Steps to create a Docker Image and Deploy to Kubernetes in 8 easy steps. This post is about the title of this post which is 'How to Deploy docker image to kubernetes' For this post, we have used minikube cluster and…

  • Docker Weblogic : Run Oracle Weblogic 12c on Docker

    The Introduction to Docker Weblogic In this post, we are going to be exploring the quick and easy option available to get started with weblogic and Docker. In this post, we are going to see how to create a weblogic container in docker in a few easy steps. The post's…

  • docker pull - access denied (or) Unauthorized

    In this article we are going to see how to fix the access denied and unauthorized errors while using the containers of Most of us at times might have got this exceptions access denied and unauthorized while downloading the image using docker pull command. This article is all about…

Comments are closed.