How to load a Docker image from a tar file

You can use docker load

Usage:  docker load [OPTIONS]

Load an image from a tar archive or STDIN

Git bash console:

docker load < HDP_2.5_docker.tar

Windows cmd:

docker load -i windowsservercore.tar

Firstly, put the tar file under your user folder: i.e: C:\Users\yourName\xxx.tar

Secondly, run the Docker load CMD:

docker load -i xxx.tar

After it is done, we could see the file is loaded as Docker images by running CMD:

docker images

Load the desired docker file, assuming you are in the same directory as the tar file, you can use -

$ docker load -i filename.tar

On successful import, you will see a success message along with the image ID

Check in the docker images for the image ID that you just received:

docker images

You will see the docker loaded successfully in the docker images list. However, there is one thing worth mentioning in case you might get confused; the date reflected in the command output might reflect the date when docker is created. Assuming, docker got created 5 days ago then the same will be shown in the output. Better way to confirm if your docker is loaded or not is to check for the image ID or repo and tag name (if you know).

You can finally run the docker using the command -

$ docker run -it image-ID

you can do:

docker image import file.tar images_name:image_tag