I ran this:
docker pull 91xxxxx371.dkr.ecr.us-west-2.amazonaws.com/main_api
and nothing new was pulled, but I knew there were new images on AWS/ECR.
So I removed the existing images:
docker rmi 91xxxxx371.dkr.ecr.us-west-2.amazonaws.com/main_api
and then pulled again and of course it says it retrieved new images, but that's probably just because I deleted the local tags/images or whatever.
Why didn't the first pull command get the latest? It defaults to the latest tag.
Update:
I have to correct my answer, #David Maze (comment) is right: I described the docker run behaviour.
From the Docker documentation:
When using tags, you can docker pull an image again to make sure you have the most up-to-date version of that image
So your command should work, I don't know why it's not working, sorry.
But nevertheless you can use as a workaround tags to enforce to pull the image with the specified tag.
docker run (not docker pull) search first in your local registry on your machine. If there is the image with the tag latest, the search is satisfied and terminated. If the image with the given tag is not available in your local registry, then docker will search in a remote registry like docker hub or your own.
So the tag latest should be used with care. If you have an Image with the tag latest in your local registry then you have to delete it first, so docker get nothing and search in remote registry.
Related
I'm trying to set a docker mirror to be the default mirror to pull/push images.
As per documentation I already set the file /etc/docker/daemon.json with the following:
{
"registry-mirrors": ["https://localregistry"]
}
Then I try the following:
docker login localregistry
docker pull localregistry/image:tag > it works
docker pull image:tag > doesn't work
I'm always getting "no basic auth credentials error" from the docker daemon, but from the registry log I get err.code="manifest unknown" err.detail="unknown tag"
Any idea?
I'm using docker version 19.03.08
docker login localregistry
First, I hope this is changing the name for the question, because the registry name localregistry will not work...
docker pull localregistry/image:tag > it works
The fact that this works indicates that you likely have a registry name with a . or : in the hostname. Otherwise docker would try to pull localregistry/image:tag from the localregistry user on Docker Hub.
docker pull image:tag > doesn't work
This should always work, failures should be transparent to the user if it's really a mirror of Docker Hub. What happens is it resolves that name to docker.io/library/image:tag, first tries to pull from localregistry/library/image:tag, and any error falls back to a pull from Docker Hub, and any error there finally shows to the user.
Most likely the issue is that you didn't include library as the repo name for your image in the local registry.
If you are using this to include images that don't exist on Docker Hub, then I would skip the mirror and simply refer to the mirror explicitly. Doing otherwise creates many opportunities for nonintuitive failures that aren't easy to see. E.g. a stale image can be pushed to your mirror in place of an upstream image, and Docker will stop pulling updates from upstream. And because any mirror errors fall back to Hub, if you use an image name that you have no control over upstream, someone else could take that name on Hub and begin injecting unknown or even malicious images into your server.
If this doesn't answer your question, then I'd recommend using your question with actual image names and error messages from the logs showing what specifically failed (you can mask out part of the registry name of necessary).
When we run a docker container if the relevant image is not in the local repo it is being downloaded but in a specific sequence i.e parent images etc.
If I don’t know anything about the image how could I find from which images is being based on based on the layers pulled as displayed in a docker run?
The output only shows the SHA1s on any docker run etc
AFAIK, you can't, there is no reverse function for a hash.
Docker just tries to get the image from local, when its not available tries to fetch it from the registry. The default registry is DockerHub.
When you don't specify any tag when running the container ie: docker run ubuntu instead of docker run ubuntu:16.04 the default latest is used. You'll have to visit the registry and search which version the latest tag is pointing to.
Usually in DockerHub there is a link pointing the GitHub repo where you can find the Dockerfile, in the Dockerfile you can find how its built, including the root image.
You also can get some extra info with docker image inspect image:tag, but you'll find more hashes in the layers.
Take a look to dockerfile-from-image
"Similar to how the docker history command works, the dockerfile-from-image script is able to re-create the Dockerfile (approximately) that was used to generate an image using the metadata that Docker stores alongside each image layer."
With this, maybe you can get the source of the image.
I created a docker repo which I wanted to pull for a local copy.
I want to create an image that can be used by anyone and everyone in the team will have a common work env.
I ran this command on my Ubuntu 14.04 :
docker pull xanthelabs/dev
The output is :
Using default tag: latest
Pulling repository docker.io/xanthelabs/dev
Tag latest not found in repository docker.io/xanthelabs/dev
I am new to docker and dont know what to do to remove this error. What should I be doing?
PS: I've been able to successfully pull images that are already available on the hub like ubuntu:14.04 and centos, so I know the installation is up and working.
To pull images first you need to push something to your repo. I checked https://hub.docker.com/r/xanthelabs/dev/ and it seems that you haven't pushed anything yet.
So first (in directory with your Dockerfile):
docker build --tag xanthelabs/dev .
docker push xanthelabs/dev
And then:
docker pull xanthelabs/dev
For doing pushes you need to be logged in (docker login).
When I run in docker 1.2 docker pull ubuntu a lot of tags are downloaded. (In the version 1.3 this was changed — to download all the tags I need to run docker pull ubuntu --all-tags
I know that I can see the tags what are going to be downloaded on the Docker Hub — https://registry.hub.docker.com/_/ubuntu/tags/manage/
Is there a way to find out the list of tags that are to be downloaded from docker console utilities?
Docker pull without an explicit tag will pull the "latest" tag. If you call pull with "--all-tags" flag it should then pull all the tags for that image.
Documentation for docker pull is here:
https://docs.docker.com/reference/commandline/cli/#pull
The docker repositories contains multiple images. Is it possible to just pull the specific image from Repository.
When I use:
docker pull ubuntu
It pulls down around 8-10 different versions of ubuntu.
If there's a specific image that's tagged, you could use the --tag= (or -t) operator to pull the specific image you're looking for. There's a shorthand form for the command as well, which uses just a colon between the image name and the tag.
So if you want the version of ubuntu that's tagged as quantal, you could use:
docker pull ubuntu:quantal
The longer forms would be:
docker pull --tag="quantal" ubuntu
docker pull --t quantal ubuntu
This will still pull the historical layers used to build the final image, but will be a smaller subset than all of the layers for ubuntu.
[Updated to include Ben's note on shorthand from below. Thanks!]
You can also use
docker pull reponame:tagname
docker pull ubantu:quantal