How to use Docker Images offline
Are you looking for a way to save a docker image offline or to transfer to an on-premises environment or share with your team?
Create a folder for where you are going to save your docker image.
$ mkdir docker
Enter Folder
$ cd docker
Make sure you have an image from the docker repository of your choice.
Pull image of your choice from dockerhub:
$ docker pull python:3.11-rc-alpine
Check that your image has been pulled into docker on your computer:
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
python 3.11-rc-alpine 123456h8d987 1 minute ago 51MB
Save the image into tarball on your computer:
$ docker save python:3.11-rc-alpine > python_3_11_alpine.tar
$ls
python_3_11.tar
You should be able to transfer that .tar file and load it with the following:
$ docker load --input python_3_11_alpine.tar
1234567ds89e8: Loading layer 1.23MB/1.23MB
1234567ds89e8: Loading layer 1.23MB/1.23MB
1234567ds89e8: Loading layer 1.23MB/1.23MB
1234567ds89e8: Loading layer 1.23MB/1.23MB
1234567ds89e8: Loading layer 1.23MB/1.23MB
Loaded image: python:3.11-rc-alpine
Check if your image is loaded
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
python 3.11-rc-alpine 123456h8d987 1 minute ago 51MB
$ docker run --name python_3.11 python:3.11-rc-alpine
python_3.11