I'm following the Getting Started tutorial on the docker page, I have an image locally and have created a repo via the Docker Hub web page at https://hub.docker.com/r/banksysan/docker-whale/.
I've got a config.json like so:
{
"auths": {
"https://index.docker.io/v1/": {
"auth": "secret_string",
"email": "BanksySan#googlemail.com"
}
}
}
When I run the push though I get an authentication error:
David#Plod MINGW64 ~
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
banksysan/docker-whale latest 654156f34320 41 minutes ago 274.2 MB
docker-whale latest 654156f34320 41 minutes ago 274.2 MB
hello-world latest 0a6ba66e537a 3 months ago 960 B
kitematic/hello-world-nginx latest 38502dd72c08 7 months ago 7.913 MB
docker/whalesay latest ded5e192a685 8 months ago 247 MB
David#Plod MINGW64 ~
$ docker push banksysan/docker-whale
The push refers to a repository [docker.io/banksysan/docker-whale] (len: 1)
654156f34320: Preparing
unauthorized: access to the requested resource is not authorized
What extra thing do I need to do that I'm missing?
Related
I have created my custom image using mongoclient and ycsb. Trying to push the image in my repo but getting "denied: requested access to the resource is denied" error.
I followed below steps:
$ sudo docker login https://hub.docker.io -u <username>
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
<username>/mongoclient.ycsb ycsb d5df3ee39a2b 6 days ago 1.72 GB
docker.io/mongo latest af93e1bc9e2b 6 weeks ago 379 MB
docker.io/ycsb latest f13g3d629b1x 6 weeks ago 829 MB
$ sudo docker image push <username>/mongoclient.ycsb
The push refers to a repository [docker.io/<username>/mongoclient.ycsb]
0290cf7cgg01: Preparing
36337d65455g: Preparing
f3v7673685cb: Preparing
41c4edef8f6b: Preparing
ad6b931d9136: Preparing
506gc50g7a7b: Waiting
ae2dec2d34b1: Waiting
581ae1d6061a: Waiting
518d9e7fb316: Waiting
a4ecb2aa7787: Waiting
9a2e8a91bfb9: Waiting
a477b6b9ca24: Waiting
aa0c3a991ccd: Waiting
ce6476f44b21: Waiting
911d45679c35: Waiting
4b11524b05bf: Waiting
denied: requested access to the resource is denied
I had already created the public repo ""mongoclient.ycsb on my account.
I've been toying with a docker image for Tensorflow.
To summarize, I first installed the standard image, then realized I needed nodejs, so added it and did a docker commit. Then realized I needed expressJS, added it an did a commit
I am running docker v1.12.5 (so the new gc/prune commands are not there)
At this stage, docker images -a shows:
REPOSITORY TAG IMAGE ID CREATED SIZE
tensor-node-express latest f2f59eb61aae 15 hours ago 2.104 GB
gcr.io/tensorflow/tensorflow latest-devel 308238445d5c 2 days ago 1.995 GB
gcr.io/tensorflow/tensorflow <none> 74435614a991 9 days ago 1.52 GB
I only want to keep tensor-node-express and delete the older images.
$ docker rmi 308238445d5c
Error response from daemon: conflict: unable to delete 308238445d5c (cannot be forced) - image has dependent child images
$docker rmi gcr.io/tensorflow/tensorflow:latest-devel
Error response from daemon: conflict: unable to remove repository reference "gcr.io/tensorflow/tensorflow:latest-devel" (must force) - container 03de9d864e31 is using its referenced image 308238445d5c
I assumed that this means docker commits store differential images, but when I go to ~/.docker/machine/machines/default, I see:
40894464 Mar 13 13:57 boot2docker.iso
5043847168 Mar 16 08:34 disk.vmdk
I suppose the 5G file is a composite of my images, which seems to show each docker commit is the full image!
Any thoughts on how I can only use the latest docker image (tensor-node-express) and free my HD of the invasion of docker?
Supplementary info - here is the output of docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e6dcd2915991 tensor-node-express "/bin/bash" 15 hours ago Exited (130) 15 hours ago flamboyant_bose
fb44b19a21c2 gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 18 hours ago Exited (130) 15 hours ago compassionate_bose
075001a687e3 gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 18 hours ago Exited (0) 18 hours ago nervous_sinoussi
a80ce2d2e688 gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 19 hours ago Exited (130) 18 hours ago happy_euclid
f493bd3c8712 gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 19 hours ago Exited (1) 19 hours ago friendly_cori
03de9d864e31 gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 2 days ago Exited (255) 23 minutes ago 6006/tcp, 8888/tcp tender_hopper
2dd1e83d62d3 gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 2 days ago Exited (0) 15 hours ago modest_einstein
3067ed171b1c gcr.io/tensorflow/tensorflow:latest-devel "/bin/bash" 2 days ago Exited (0) 2 days ago dazzling_bhabha
62c699afd3fd 74435614a991 "/bin/bash" 2 days ago Exited (127) 2 days ago inspiring_austin
9523ffe2945c 74435614a991 "/bin/bash" 2 days ago Exited (0) 2 days ago kickass_leakey
e06958ea517c 74435614a991 "/bin/bash" 2 days ago Exited (0) 2 days ago objective_euler
ccf922954667 74435614a991 "/bin/bash" 2 days ago Exited (255) 2 days ago dreamy_bartik
fad0d92a07a3 74435614a991 "/bin/bash" 2 days ago Exited (130) 2 days ago elastic_dubinsky
f2a98d4e11ea 74435614a991 "/bin/bash" 2 days ago Exited (0) 2 days ago heuristic_kilby
f07e46367b17 74435614a991 "/bin/bash" 2 days ago Exited (130) 2 days ago trusting_darwin
5bbf9cf992b8 74435614a991 "/bin/bash" 2 days ago Exited (0) 2 days ago flamboyant_knuth
I tried
docker ps --filter "status=exited" | grep "days ago" | awk '{print $1}' | xargs docker rm (credit)
I ran the above manually as well for some of the containers it missed
That pruned the ps list to:
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e6dcd2915991 tensor-node-express "/bin/bash" 15 hours ago Exited (130) 15 hours ago flamboyant_bose
But even then I can't delete old images - same error.
Further update, I tried to list dependencies in images (credit)
using this script:
for i in $(docker images -q)
do
docker history $i | grep -q 74435614a991 && echo $i
done | sort -u
And it told me:
308238445d5c
74435614a991
f2f59eb61aae
This means my new images are child images of the old image. But the size is not a differential looking at the disk size.
Thoughts?
docker-machine uses a Linux VM
When you looked at the docker-machine .vdmk and .iso files, what you are looking at is files for a Linux VM running on your Mac. This is needed because Docker requires Linux kernel features to run, it cannot run directly on the Mac's microkernel.
So your Mac is running a Linux virtual machine, and inside that virutal machine is running the Docker daemon and all of your containers.
Therefore the file size of the .vmdk and .iso tell you nothing about any one image.
docker images have parent/child relationships
As you may already know, docker images have parents and/or children. For instance when you build an image with a Dockerfile like this:
FROM ubuntu:latest
RUN apt-get update && apt-get install nginx
You will end up with a new image that you have perhaps tagged my-nginx. But it requires the ubuntu:latest image as its parent; you cannot delete ubuntu:latest with this image still around, as it requires its parent.
docker commit creates those relationships
When you use docker commit, you are basically doing a dynamic snapshot build. It is similar to the above, except there's no Dockerfile involved.
The above example has a FROM line which indicates the image to use as a base. When using commit, there is a base implied - whatever image was used to launch the running container that you are committing.
The above example has a RUN command which will create new contents in the built image, above and beyond the base image. In a real Dockerfile there are usually multiple commands that do various things which build on the base image. When you use commit, you don't have that. Instead, anything that has been written to the container on top of the base image is your new content. It exists in a read-write filesystem layer in the container. That is the thing you are committing; it is written as a new read-only layer and you get that back as a new (immutable, read-only) docker image. With a parent.
Based on your comments, and the question itself, you appear to have believed that using docker commit would create a new full image that had no dependencies on other images. That is not true. You can craft images like that if you build them yourself from scratch, just not this way.
You can untag the image
If what you want is for the image to not show up in your list, that's easy. Just untag it.
docker rmi gcr.io/tensorflow/tensorflow:latest-devel
However, this is more or less cosmetic. The image will still be there, as another image requires it. All this does is remove the tag, so it doesn't appear in the docker images list anymore without the -a flag.
The reason trying this did not work for you is you tried to rmi the image using its ID, not using its tag.
I'm following https://docs.docker.com/registry/deploying/ and I have installed on docker.tp.cselt.it a private docker registry
> sudo docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
registry 2 65b0a3f42eef 7 days ago 165.8 MB
dockerui/dockerui latest 95c8b9dc91e0 6 weeks ago 6.13 MB
> sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e142b5f0933e registry:2 "/bin/registry /etc/ 7 minutes ago Up 7 minutes 0.0.0.0:5000->5000/tcp registry
1d5c9e515118 registry:2 "htpasswd -Bbn testu 7 minutes ago Exited (0) 7 minutes ago romantic_jang
ae7b5d62628f dockerui/dockerui:latest "/dockerui" About an hour ago Up About an hour 0.0.0.0:9000->9000/tcp goofy_meitner
On another machine, I'm trying to push an image (hello-world) on that registry:
> docker login docker.tp.cselt.it:5000
Username (testuser):
WARNING: login credentials saved in /home/administrator/.docker/config.json
Login Succeeded
> docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
b901d36b6f2f: Pull complete
0a6ba66e537a: Pull complete
Digest: sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7
Status: Downloaded newer image for hello-world:latest
> docker tag hello-world docker.tp.cselt.it:5000/hello-world
> docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
docker.tp.cselt.it:5000/hello-world latest 0a6ba66e537a 5 months ago 960 B
hello-world latest 0a6ba66e537a 5 months ago 960 B
> docker push docker.tp.cselt.it:5000/hello-world
The push refers to a repository [docker.tp.cselt.it:5000/hello-world] (len: 1)
0a6ba66e537a: Image already exists
b901d36b6f2f: Image already exists
latest: digest: sha256:1c7adb1ac65df0bebb40cd4a84533f787148b102684b74cb27a1982967008e4b size: 2744
Now, on the first machine (docker.tp.cselt.it):
> sudo docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
registry 2 65b0a3f42eef 7 days ago 165.8 MB
dockerui/dockerui latest 95c8b9dc91e0 6 weeks ago 6.13 MB
> sudo docker exec -it 65b0a3f42eef bash
> ls /var/lib/registry/docker/registry/v2/repositories/
centos hello-world ubuntu
But when I run:
> curl -u testuser:testpassword -X GET http://docker.tp.cselt.it:5000/v2/_catalog --noproxy docker.tp.cselt.it
I receive ""
What's wrong?
Riccardo
curl --noproxy docker.tp.cselt.it -u testuser:testpassword --insecure -X GET https://docker.tp.cselt.it:5000/v2/_catalog
{"repositories":["hello-world"]}
Using the command docker images, you can list all images on your host:
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
scdockerdemo_php latest 155d80ea7642 4 minutes ago 265.3 MB
scdockerdemo_node latest 6189bc65c3fe 8 minutes ago 861.4 MB
php 5.6-apache fc50bce69ea0 3 days ago 481.3 MB
node 4.1 fc81e574af43 3 days ago 641.1 MB
With docker images -f "tag=latest", you can filter for images with a certain tag.
How can I filter for a repository name? E.g. docker images -f "repository=scdockerdemo_*"
This command always return Invalid filter 'repository'
https://docs.docker.com/reference/commandline/images/
If you want to filter by repository name(eg: testImage), just use the following:
docker images testImage
When you have multiple images with same repository name but diffetent tags, you can specify tags on the repository name by using a ':' ( For example, testImage:<whatever tag>)
Source: Docker images
According to the documentation at https://docs.docker.com/engine/reference/commandline/images/ you can match by wildcard by enclosing in double quotes:
docker images "scdockerdemo_*"
** special chars **
when you have special characters like '/' in the repository name, you should escape it to filter by repository name.
ex)
> docker images "zirho6\/*"
REPOSITORY TAG IMAGE ID CREATED SIZE
zirho6/aaaa latest 946bf5cc28fc 2 days ago 997MB
zirho6/bbbb latest 741a6e368d07 10 days ago 866MB
zirho6/ccc latest 173b36570522 12 days ago 853MB
zirho6/dddd latest e08e5c202e9b 13 days ago 853MB
You can filter images by reference (combination of name and tag):
docker image ls --filter 'reference=scdockerdemo_*'
According to this answer to a similar question, the filter option currently only supports "dangling=true".
If you're using Bash, the easiest thing to do is probably:
$ docker images | grep scdockerdemo
Or, you can try using awk to match on a string in the first column:
$ docker images | awk '$1 ~ /scdockerdemo/ { print }'
There is my solution for filter Docker images by name
List all my Docker images
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED
pay-with-crypto-apis_store-management latest fd78ce3a6869 27 minutes ago
pay-with-crypto-apis_webhooks latest a305d3a8bd5c 28 minutes ago
pay-with-crypto-apis_invoices latest 1ded36a0dfb1 29 minutes ago
pay-with-crypto-apis_authentication latest 73cf83569a45 30 minutes ago
pay-with-crypto-apis_gateway latest f6a8ccadd645 34 minutes ago
node 14-alpine 47afee183159 2 months ago
node 18 e3cb0fb99b7c 2 months ago
btcpayserver/btcpayserver 1.5.4 f4a433460739 3 months ago
nicolasdorier/nbxplorer 2.3.26 121100cdb31b 3 months ago
saubyk/c-lightning-rest 0.7.2 7924309b4d7d 3 months ago
shahanafarooqui/rtl 0.12.3 da155f98b998 4 months ago
mongo latest 27dd1be4bed1 4 months ago
I wanna to filter by pay-with-crypto-apis
$ sudo docker images "pay-with-crypto-apis_*"
REPOSITORY TAG IMAGE ID CREATED
pay-with-crypto-apis_store-management latest fd78ce3a6869 26 minutes ago
pay-with-crypto-apis_webhooks latest a305d3a8bd5c 27 minutes ago
pay-with-crypto-apis_invoices latest 1ded36a0dfb1 28 minutes ago
pay-with-crypto-apis_authentication latest 73cf83569a45 29 minutes ago
pay-with-crypto-apis_gateway latest f6a8ccadd645 33 minutes ago
Provide another option for reference
docker images | ruby -ne ' puts $_ if $_ =~ /harbor/ '
Let the commands speak for themselves:
on a host called: coreworker
core#coreworker-1 ~ $ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
hub-docker-repo:5000/485d5874-c786-4b90-93ac-8db5342a6059 1 bbd5d4d98156 31 minutes ago 139.3 MB
ec2-54-169-239-164.ap-southeast-1.compute.amazonaws.com:5000/hub-action-repository latest 66ecb895d185 14 hours ago 856.4 MB
ec2-54-169-239-164.ap-southeast-1.compute.amazonaws.com:5000/hub-ext-node-base 0.12.7 f2f1afc202e4 8 days ago 136.6 MB
...
core#coreworker-1 ~ $
on a host called devhost
core#devhost ~ $ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<none> <none> 67e45ce93dee 48 minutes ago 725 MB
node 0.12.7 a4b45afffe4a 5 days ago 642.2 MB
jwnintex/mesos-worker latest 42f1b41b0089 5 weeks ago 504 MB
jwnintex/nginx-port-router latest 11edcdf1a5fc 9 weeks ago 126.4 MB
jwnintex/consul latest e66fb6787628 10 weeks ago 69.4 MB
jwnintex/mesos-master latest 187d84106a3e 3 months ago 561.8 MB
jwnintex/marathon latest b1d8dd91146a 3 months ago 699.3 MB
jwnintex/zookeeper latest 9b72d56707c9 4 months ago 304.3 MB
jwnintex/registrator latest b1c29d1a74a9 6 months ago 11.79 MB
but when I do:
core#devhost ~ $ docker images -a hub-docker-repo:5000
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
now run the image on devhost residing in hub-docker-repo
veryify it's up:
core#devhost ~ $ ping hub-docker-repo
PING hub-docker-repo.service.consul (172.17.8.150) 56(84) bytes of data.
64 bytes from coreworker-1.node.dc1.consul (172.17.8.150): icmp_seq=1 ttl=63 time=8.27 ms
64 bytes from coreworker-1.node.dc1.consul (172.17.8.150): icmp_seq=2 ttl=63 time=5.19 ms
now try it
core#devhost ~ $ docker run -d hub-docker-repo:5000/485d5874-c786-4b90-93ac-8db5342a6059:1
Unable to find image 'hub-docker-repo:5000/485d5874-c786-4b90-93ac-8db5342a6059:1' locally
Pulling repository hub-docker-repo:5000/485d5874-c786-4b90-93ac-8db5342a6059
FATA[0000] Error: image 485d5874-c786-4b90-93ac-8db5342a6059:1 not found
Now try it on coreworker which is actually hosting the registry (as a docker image)
core#coreworker-1 ~ $ docker run -d hub-docker-repo:5000/485d5874-c786-4b90-93ac-8db5342a6059:1
98d642c1bafd30569d853e92167c7b4fe720bd67f65ec0d0719ec5a36bb6616f
Why am I not able to run that remote image? Or better, even discover it?
It turns out the image had never been pushed and so couldn't be seen by the other host.