“naming to docker.io”, explanation and prevention?

docker.io/library is the default registry applied when you don’t specify a registry URL.

When you specify -t in the build command, the text before the / is considered the registry URL.

Here is an example of building an image, one without a specific registry and one with:

# no registry specified
➜  docker build . -t my-image
[+] Building 0.5s (6/6) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                                                                                   0.0s
 => => transferring dockerfile: 86B                                                                                                                                                                                                                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/ubuntu:20.04                                                                                                                                                                                                                                                                                                        0.0s
 => CACHED [1/2] FROM docker.io/library/ubuntu:20.04                                                                                                                                                                                                                                                                                                                   0.0s
 => [2/2] RUN cat /etc/lsb-release                                                                                                                                                                                                                                                                                                                                     0.4s
 => exporting to image                                                                                                                                                                                                                                                                                                                                                 0.0s
 => => exporting layers                                                                                                                                                                                                                                                                                                                                                0.0s
 => => writing image sha256:4a97ceefb5314bdf91886a28142c9b0b33c992c94b1847d5ae1b38723b2279e3                                                                                                                                                                                                                                                                           0.0s
 => => naming to docker.io/library/my-image                                                                                                                                                                                                                                                                                                                0.0s

# registry set to "my.docker.registry"
➜ docker build . -t my.docker.registry/my-image
[+] Building 0.1s (6/6) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                                                                                   0.0s
 => => transferring dockerfile: 36B                                                                                                                                                                                                                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/ubuntu:20.04                                                                                                                                                                                                                                                                                                        0.0s
 => [1/2] FROM docker.io/library/ubuntu:20.04                                                                                                                                                                                                                                                                                                                          0.0s
 => CACHED [2/2] RUN cat /etc/lsb-release                                                                                                                                                                                                                                                                                                                              0.0s
 => exporting to image                                                                                                                                                                                                                                                                                                                                                 0.0s
 => => exporting layers                                                                                                                                                                                                                                                                                                                                                0.0s
 => => writing image sha256:4a97ceefb5314bdf91886a28142c9b0b33c992c94b1847d5ae1b38723b2279e3                                                                                                                                                                                                                                                                           0.0s
 => => naming to my.docker.registry/my-image

The image tag specifies where the image will be uploaded if you do a docker image push <image name>.

In the first case, if you did docker image push my-image it would push to docker.io/library.

In the second case, if you did docker image push my.docker.registry/my-image it would push to a registry at the URL my.docker.registry (assuming it exists)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)