I'm trying to push my docker image up into the public docker registry:
$ docker login
Username (binarybana):
WARNING: login credentials saved in /home/jknight/.dockercfg.
Login Succeeded
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
binarybana/dev-fedora latest 10c7881fbaca 24 hours ago 1.148 GB
binarybana/fedoradev latest 10c7881fbaca 24 hours ago 1.148 GB
binarybana/fedora-dev latest 10c7881fbaca 24 hours ago 1.148 GB
<none> <none> b44397dc4c99 24 hours ago 1.148 GB
<none> <none> a98c27ba4738 24 hours ago 1.141 GB
<none> <none> 775c74a34add 24 hours ago 1.141 GB
<none> <none> 2be2491d2354 24 hours ago 1.141 GB
docker.io/fedora 21 93be8052dfb8 7 days ago 241.3 MB
$ docker push binarybana/dev-fedora
Do you really want to push to public registry? [Y/n]: Y
The push refers to a repository [docker.io/binarybana/dev-fedora] (len: 0)
FATA[0001] Repository does not exist: docker.io/binarybana/dev-fedora
$ docker push binarybana/fedora-dev
Do you really want to push to public registry? [Y/n]: Y
The push refers to a repository [docker.io/binarybana/fedora-dev] (len: 0)
FATA[0002] Repository does not exist: docker.io/binarybana/fedora-dev
Yet, I've already created the repository (viewable here). And I've also tried to push to repository names that I haven't already created (the first try in the example above).
I think the (len: 0) has something to do with it, but I can't google it. Also I originally created the image from a dockerfile as:
docker build -t binarybana/fedora-dev .
Thanks.
Always build your image with "username" and "tag"
docker build -t <username>/dev-fedora:latest .
After building push the image
docker push <username>/dev-fedora:latest
if you are using docker.io ( dockerhub repo ), you need to tag it including the name docker.io in it.
docker tag ${image_id} docker.io/${login_name}/${image_name}
and then
docker push docker.io/${login_name}/${image_name}
is OK.
I also encountered this error Repository does not exist: gcr.io/my-project-id/my-container when attempting to push an image to Google Container Registry.
My confusion came from a misunderstanding of Docker's definition of "repository".
A repository is a set of Docker images. A repository can be shared by pushing it to a registry server. The different images in the repository can be labeled using tags.
When Docker says that a repository does not exist, it means that there is no image that it can find locally that is tagged with that registry.host/user-name/image-name combination.
Note: The Docker Hub registry is the default, so that part can be omitted if you are pushing there.
Steps to fix this issue:
Double check what images you have available locally.
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
gcr.io/my-proj/my-typo v1 40c2ae2dedb8 2 days ago 427.8 MB
If there is a typo, you can run the docker tag command to fix it.
$ docker tag gcr.io/my-proj/my-typo:v1 gcr.io/my-proj/my-cntr:v1
Now, you should be able to push the image using the complete name, including the tag.
$ docker push gcr.io/my-proj/my-cntr:v1
Note: Use gcloud docker -- push instead of docker push if you are pushing to the Google Container Registry.
If you are using Amazon AWS, before you can push your Docker images to Amazon ECR, you need to create a repository to store them in. You can create Amazon ECR repositories with the AWS Management Console, or with the AWS CLI and AWS SDKs.
To create a repository
1.) Open the Amazon ECS console at https://console.aws.amazon.com/ecs/.
2.) From the navigation bar, choose the region to create your repository in.
3.) On the Repositories page, choose Create repository.
4.) For Repository name, enter a unique name for your repository and choose Next step.
5.) Now you should be able to push to your AWS repo!
You need to use the complete image name. When you don't specify the tag while building, it's latest, so you should say
docker push binarybana/fedora-dev:latest
Adding to Santosh Gandhe's answer, if you want to push to specific repository rather than under your login name
docker tag ${image_name} docker.io/${login_name}/${remote_repo_name}:${image_name}
and then
docker push docker.io/${login_name}/${remote_repo_name}:${image_name}
Also, don't forget to do docker login first.
Related
Let's say I have an account on docker hub and my username is hub_user.
I create a repository called react-dev on it.
Now on my machine, I have created an image tagged company/react/dev.
I can see it using docker image ls:
REPOSITORY TAG IMAGE ID CREATED SIZE
company/react/dev latest f344922a299e 7 minutes ago 368MB
Now I'm stuck at pushig this image into that hub repository.
This command does not work:
docker push company/react/dev
Using default tag: latest
The push refers to repository [docker.io/company/react/dev]
f63cd7f19f75: Preparing
e8aee5ec6588: Preparing
48ee8f528027: Preparing
f3abd083ca1f: Preparing
d02e39b7f91a: Preparing
0586d9cce1ac: Waiting
48286fbe1b87: Waiting
f22adfb1c0f3: Waiting
9a5d14f9f550: Waiting
denied: requested access to the resource is denied
What should I do?
You will have to use hub_user/react-dev when push.
For your scenario, you could use docker tag to create a tag TARGET_IMAGE that refers to SOURCE_IMAGE, see this.
Then, something like next could work:
$ docker tag company/react/dev hub_user/react-dev
$ docker push hub_user/react-dev
Well the tag and push should follow the convention like this while pushing to dockerhub.
dockerhub_username/repo_name:$TAG
so when building/tagging image it should be like this
docker build -t hub_user/react-dev:latest
Then push the same image
docker push hub_user/react-dev:latest
When I run the command docker ps I get a list of containers like this:
6f8d5585918f 56058f3d1997 "test" 23 hours ago Up 23 hours test1
18edba56bfeb 2482781314c7 "java -jar test2" 2 days ago Up 2 days 0.0.0.0:8206->8484/tcp test2
The second column is the image. I want to push the second image as test11 to our private repo. I don't have the files to build the image. How would I do this?
First you must tag the image ID. The you must login to your private Docker registry. (The correct name is registry and not repository. A Docker registry holds repositories). Then you push the image.
Substitute privateregistry with the hostname of the Registry.
docker tag 2482781314c7 privateregistry/test11
docker login privateregistry
docker push privateregistry/test11
On a coreOS (899.15.0) machine, when I execute docker search and images I get the following results :
docker search private-registry:5000/
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker images on the private registry machine:
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
nginx latest e32087da8ee6dfa45221c48670fa9475f3d8a53a0e9ccabef4f741c62c77d49b 2 weeks ago 182.6 MB
registry 0.9.1 facc02b3acf6f811e8eace6d07b34cd5ab687e926ac5b5231da93264b259f1a4 12 weeks ago 422.8 MB
<none> <none> db81ebdc7ebd3d7aec05d4faa6f4c9c2e35954896e968bce2f90a9736485aa06 3 months ago 422.8 MB
...and a few more images
The reference for docker search mentions that it looks up on docker hub, but since I am specifying a specific registry here, I suppose it is looking up in the private repository.
I am not sure what is the difference between these two commands here and why the difference in results.
You are supposing wrongly. docker search searches only Docker Hub, not private registries. docker images command lists images on the machine (locally built or pulled from registries).
If you want to search or list images in the private registry, you need to use registry API to do so: https://docs.docker.com/registry/spec/api/
I am new to docker. created a public repo under my account
link to repo
I am able to pull other public repos like redis and debian:
docker ps ✱
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
40416ad4c715 debian:latest "/bin/sh -c 'while t 6 minutes ago Up 6 minutes dal_server
but when trying to pull from my repo i get an error:
docker pull opmaster/basic_server ✱
Pulling repository opmaster/basic_server
FATA[0009] Repository not found
docker push opmaster/basic_server ✱
The push refers to a repository [opmaster/basic_server] (len: 0)
FATA[0000] Repository does not exist: opmaster/basic_server
>> docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
debian latest 41b730702607 10 days ago 125.1 MB
hello-world latest 91c95931e552 3 weeks ago 910 B
>> docker tag 41b730702607 opmaster/basic_server:devel
>> docker push opmaster/basic_server
docker push can get be little long from my short experience, so i stopped it with ctrl-c, did boot2docker restart and started again with the docker push opmaster/basic_server
if someone knows a better way, i'm open to suggestions.
You don't appear to have a valid image on dockerhub. How did you create the image that is there? I see if, but there isn't anything in it.
Your images are created by pushing an image that you have locally, or with a Dockerfile (you can buuild an image). There is a good write up on how to push an image here:
https://docs.docker.com/userguide/dockerrepos/
Once you get a valid image pushed, pulling it will be possible. I have found pushing images (like the one you have listed in your docker ps) is easier to do if you tag it first. However, the easiest way to make images is to create a project for it on github, have a Dockerfile in that project, then auto build it (github checkin triggers a build on dockerhub).
https://registry.hub.docker.com/_/ubuntu/
There is a _ in the url before the product name.
What is it for?
If you have a account on dockerhub called foobar:
# pull from your account (foobar)
docker pull foobar/ubuntu:latest
Otherwise, if you omit the username:
# pull from the official account (library)
docker pull ubuntu:latest
# almost the same as
docker pull library/ubuntu:latest
The underscore(_) is a special namespace used to publish the official repositories.
https://registry.hub.docker.com/_/ubuntu/ is almost the same as https://registry.hub.docker.com/u/library/ubuntu/
The only difference is that you will get different image-names with identical image-id:
$ docker pull ubuntu:latest
$ docker pull library/ubuntu:latest
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
library/ubuntu latest 86ce37374f40 7 days ago 192.7 MB
ubuntu latest 86ce37374f40 7 days ago 192.7 MB