I need to change the name of the Docker repository. For example...
ORIGINAL:
[root#docker ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.access.redhat.com/rhel7/rhel latest e64297b706b7 2 weeks ago 201MB
RENAMED:
[root#docker ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
rhel 7.5 e64297b706b7 2 weeks ago 201MB
You do not 'rename' images. What you see in docker images are tags. You can add a new tag or delete one, but not 'rename'. Try tagging your image with the new tag that you want and then (optionally), delete the old tag, e.g.:
docker tag registry.access.redhat.com/rhel7/rhel:latest rhel:7.5
docker rmi registry.access.redhat.com/rhel7/rhel:latest # remove old tag
Related
Using :latest image as a base, I have created a new image tagged with :v1.1.0-fermium. After tagging, the newly tagged image :v1.1.0-fermium appears within registry listing of docker images, including :latest
Problem: The :latest image can be pulled from registry, but not the newly tagged :v1.1.0-fermium image, not found registry.
Question: Is there a step I am missing when tagging a docker image in order to be found when pulling from a docker registry?
$ docker image tag docker.foo.com/bar-build:latest docker.foo.com/bar-build:v1.1.0-fermium
$ docker image ls docker.foo.com/bar-build
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.foo.com/bar-build latest 35bfeb2c6323 5 hours ago 5.03GB
docker.foo.com/bar-build v1.1.0-fermium 35bfeb2c6323 5 hours ago 5.03GB
$ docker pull docker.foo.com/bar-build:latest
latest: Pulling from bar-build
$ docker pull docker.foo.com/bar-build:v1.1.0-fermium
Error response from daemon: manifest for docker.foo.com/bar-build:v1.1.0-fermium not found: manifest unknown: The named manifest is not known to the registry.
Kindly Push the docker image into hub.docker.com for publishing it and then you can pull the image.
I just created an image :
docker build firstimage .
and tagged it as sohrabp72/firstimage and then pushed it into my repo on the Docker hub:
docker tag firstimage sohrabp72/firstimage
Then I removed the tagged image and the original image from my local machine:
docker rmi sohrabp72/firstimage
docker rmi firstimage
Now when I want to pull the image from the Docker hub repository, my local Docker does not pull it:
C:\Users\Sohrab> docker pull sohrabp72/firstimage
Using default tag: latest
latest: Pulling from sohrabp72/firstimage
cbdbe7a5bc2a: Already exists
9287919c3a0f: Already exists
43a47bbd54c9: Already exists
3c1bcea295c4: Already exists
53e2ab46e733: Already exists
3b08dc288a15: Already exists
e01ad7774a4c: Already exists
Digest: sha256:f16f1cfd9e777898511259e7ff512947c27b7e7bb4f4333dd27bd809bdc77995
Status: Downloaded newer image for sohrabp72/firstimage:latest
docker.io/sohrabp72/firstimage:latest
PS C:\Users\Sohrab>
docker logs show some lines and say already exist. and when I look at images on my local docker, that image is there:
C:\Users\Sohrab> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
getting-started latest bfc5750a86e5 11 hours ago 231MB
sohrabp72/firstimage latest 4e197282638a 22 hours ago 179MB
node 12-alpine d8b74300d554 7 days ago 89.6MB
docker/getting-started latest 1f32459ef038 3 months ago 26.8MB
Is there something like a cache for images we've pushed to Docker hub?
When docker prepares an image, it does step by step and each step creates an intermediate step with an ID. Docker by default removes the intermediate image and the last step provides a final image with an ID.
When you ran build command it actually created a final image with an ID and tagged the final image ID with your name 'firstimage'
When you tag second name, it added additional tag 'sohrabp72/firstimage'
When you ran docker rmi command on both tags, it removed tags only while image created still is there.
You can run
docker images -a
which will list image with <<"none">> in repository and name but final image created will be there with ID
you can
docker image prune -a
to clear all image and try docker pull command
I have created a docker Image, but in the Repository/Tag its showing as "None", please let me know what will be the reason.
REPOSITORY TAG IMAGE ID CREATED
none none bhc0b0d2e67f 20 hours ago
How have you built your docker image?
In order to give a tag to your image, as documented here,you have to write the command like:
docker build -t yourimage:yourtag -f yourdockerfile context/of/image
If you have already a docker image (like in your case) and you want to assign a tag to it:
docker tag bhc0b0d2e67f TARGET_IMAGE[:TAG]
I have installed docker on my Windows 10, then I've created some images.
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest 2cb0d9787c4d 3 weeks ago 1.85kB
Then I created my first machine using docker-machine create connected to hyperv driver.
so when I do docker images I get:
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
My question is how can I reconnect to the default docker engine so if I run docker images I get:
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest 2cb0d9787c4d 3 weeks ago 1.85kB
try image instead of images
docker image list
There seems to be some inconsistency w.r.t the two i.e. image/images. Though one would expect the output to be same but there are few differences.
I'm using Docker 1.12.6.
I have pulled an image from the Docker registry.
I have exported the images as tar files using the docker save command.
I removed the original image and container and loaded the exported image using docker load -i myImage.tar.
Now, when running docker images I notice my image have lost its repository/tag information:
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> 5fae4d4b9e02 8 weeks ago 581.3 MB
Why does it have this behavior and how do I keep the original image name?
Use
docker save -o filename.tar <repo>:<tag>
The command docker save <image id> removes the repository and tag names.
To solve this, use docker save <repo>:<tag> it will keep the repository and tag name in the saved file. For example:
docker save -o ubutu-18.04.tar ubuntu:18.04
I had the same problem, so I used the following command to fix it manually:
docker tag <Image-ID> <desired Name:Tag>
Reference
[NOTE]:
It's inconsistent: docker save image-repo-name -> docker load
restores name, docker save SHA -> docker load no names or tags,
docker save name:latest -> docker load no names or tags.
AND:
The current (and correct) behavior is as follows:
docker save repo
Saves all tagged images + parents in the repo, and creates a
repositories file listing the tags
docker save repo:tag
Saves tagged image + parents in repo, and creates a repositories file
listing the tag
docker save imageid
Saves image + parents, does not create repositories file. The save
relates to the image only, and tags are left out by design and left as
an exercise for the user to populate based on their own naming
convention.
Reference
A single image ID can have multiple names/tags,
so the way that you loose the the names and tags is
what I would expect to happen after saving and loading the image to/from a tar ball.
Mode details are in the discussion about it here
From docker documentation:
cat exampleimage.tgz | docker import - exampleimagelocal:new
root#mymachine:/tmp# cat myimage.tar | docker import --message "New image imported from tarball" - reponame:my-image-name
sha256:be0794427222dcb81182a59c4664b350ecb5ffb7b37928d52d72b31
root#mymachine:/tmp# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
reponame my-image-name be0794427222 6 seconds ago 4.31GB
This one worked for me.
This is a work around
Go to source docker host machine, create text file containing all the image details using the following command docker image ls > images.txt
The above command will produce a text file similar to the following
REPOSITORY TAG IMAGE ID CREATED SIZE <none> <none> 293e4ed402ba 2 weeks ago 315MB <none> <none> d8e4b0afd6ba 2 weeks ago 551MB
Make necessary edits to set the tag by using docker image tag command
docker image tag 293e4ed402ba postgres:latest
docker image tag d8e4b0afd6ba wordpress:latest
I wrote a one-line script that importing a bunch of .tar files and immediately tagging the image.
for image in $(ls); do docker tag "$(echo $(docker import $image))" $image ; done
Note, that you should be inside the folder when all the tar files are located.