user32882
user32882

Reputation: 5917

How do I know which registry an image was pulled from in Docker?

In Docker I am running a DockerFile set up as follows:

# Comment
FROM python:3.8.3

RUN pip install matplotlib

I am generating this image with the following command:

docker build -t myimage:mytag -f DockerFile .

Here's my understanding of what this does:

My question is this: is there any way to (programmatically) determine which registry the base image is pulled from?

Upvotes: 3

Views: 2265

Answers (1)

CLNRMN
CLNRMN

Reputation: 1457

Registry: You can find your default registry with the following command:

# docker info | grep -i registry
 Registry: https://index.docker.io/v1/

It shows you where docker searches if you do not specify another registry.

Example: Pull python:3.8.3 from the "default" Registry index.docker.io/v1/

# docker pull python:3.8.3
3.8.3: Pulling from library/python
...
...
...
Status: Downloaded newer image for python:3.8.3
docker.io/library/python:3.8.3

Verfiy the Image (you will see, there is no suffix to the ImageID):

# docker images | grep -i python
python                               3.8.3               7f5b6ccd03e9        6 weeks ago         934MB

Example: Pull Image nginx from the fedora registry:

# docker pull registry.fedoraproject.org/f29/nginx
Using default tag: latest
latest: Pulling from f29/nginx
...
Status: Downloaded newer image for registry.fedoraproject.org/f29/nginx:latest
registry.fedoraproject.org/f29/nginx:latest

Verify the Image (you will see, there is now a suffix to the ImageID):

# docker images | grep -i nginx
registry.fedoraproject.org/f29/nginx   latest              225d690974f7        20 months ago       368MB

Upvotes: 3

Related Questions