Docker Community Forums

Share and learn in the Docker community.

Docker save and import does not work

I have a image which works fine.
[admin@gol05854 dockerpoc]$ docker images | grep alpine
anapsix/alpine-java latest 7598ed87f3ef 2 months ago 124 MB

[admin@gol05854 dockerpoc]$ docker run -it anapsix/alpine-java java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

I saved it as a tar so that I can send it to someone.

docker save anapsix/alpine-java -o alpine-java.tar
[admin@gol05854 dockerpoc]$ ls -l alpine-java.tar
-rw-------. 1 admin admin 126402048 Dec 28 11:18 alpine-java.tar

I then imported it into another image.

[admin@gol05854 dockerpoc]$ docker import alpine-java.tar alpine-java
sha256:16ba3146389a9d3107790c7e161f06f2be7bb097d2e95796b1c86d53a9b55fa2

The image seems to be imported.
[admin@gol05854 dockerpoc]$ docker images | grep alpine
alpine-java latest 16ba3146389a 29 seconds ago 126 MB
anapsix/alpine-java latest 7598ed87f3ef 2 months ago 124 MB

Now the new image does not work
[admin@gol05854 dockerpoc]$ docker run -it alpine-java java -version
docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused “exec: “java”: executable file not found in $PATH”.
ERRO[0009] error getting events from daemon: net/http: request canceled

Same issue with any other image.
[admin@gol05854 dockerpoc]$ docker save busybox -o busybox.tar
[admin@gol05854 dockerpoc]$ docker import busybox.tar bb
sha256:db9b0819c241d66492b0067752d2cc0c0f1b35c41ad23869fda65e0da877004e
[admin@gol05854 dockerpoc]$ docker run -it bb
docker: Error response from daemon: No command specified.
See ‘docker run --help’.
[admin@gol05854 dockerpoc]$ docker run -it bb sh
docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused “exec: “sh”: executable file not found in $PATH”.

I think you are trying to do what “docker load” does. You are using the wring command.

1 Like

yes , I was able to recreate the error and also able to get it to work , it is the docker load command.

I used “docker load < alpine-java.tar” and then tagged it with “docker tag anapsix/alpine-java alpine-java”

and was able to run it with

docker@docker-datacenter-demo-1:~$ docker run -it alpine-java java -version
java version "1.8.0_102"
Java™ SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot™ 64-Bit Server VM (build 25.102-b14, mixed mode)

2 Likes