E235
E235

Reputation: 13500

"docker load" on custom images creates a <none> image name

When I am using the docker load command it created a image with <none> tag.
I will now show how to reproduce it.

I created a Dockerfile:

cat > chacha <<EOF
FROM alpine:latest
ENTRYPOINT sh;
WORKDIR /home
EOF  

Build it:

docker build -t chacha -f chacha .

Exported it to a file:

image_id=`docker images chacha -q`
docker save $image_id -o myimage.tar

Remove the old image:

docker rmi chacha

When I load the exported image:

docker load --input myimage.tar

The image name appears as <none>:

# docker images
REPOSITORY                                             TAG                 IMAGE ID            CREATED             SIZE
<none>                                                 <none>              ff35873eb8df        4 minutes ago       4.41 MB

Upvotes: 4

Views: 7868

Answers (1)

leopal
leopal

Reputation: 4959

This is the default behavior when you save an image using its image id. An image id can have multiple tags.

For instance in your case executing a docker tag $image_id chacha2 would create a new image chacha2 with the same image id as your initial image.

So when saving the image based on its image id docker daemon do not know which image's details you want to export and finally saves the image with no repository/tag details.

What you possibly need is docker save chacha > myimage.tar. When you load this tar, the imported image will contain the repository/tag details of your initial image.

More:

Upvotes: 8

Related Questions