docker push to a my-company docker repository - docker

I have an internal company docker repository.
When I was added to it, I received a repository url of the format:
https://docker.mycompany.com/repositories/myusername/myrepository
Ok. great.
I've created a Dockerfile and I have built the docker image.
docker build -t business-services:latest .
Everything works.
I do a
docker images
and I see:
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
business-services latest aaaaaaaaaaaa 3 hours ago 120MB
openjdk 8-jdk-alpine bbbbbbbbbbbb 2 weeks ago 103MB
Great!
Now I'm trying to push "business-services:latest" to:
https://docker.mycompany.com/repositories/myusername/myrepository
...
Here is where things go awry.
First, before you ask, YES, I did a login.
docker login https://docker.mycompany.com/repositories/myusername/myrepository
Username: myusername
Password:
Login Succeeded
The issue comes when I try to "tag" it and then push it.
It looks like the tag name is some kind of mixture of concerns....between the remote docker repository and the image:release. :( Boo.
If I tag it this way:
docker tag business-services:latest docker.mycompany.com/repositories/myuserna/business-services:latest
and i do docker images I see this:
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
business-services latest aaaaaaaaaaaa 3 hours ago 120MB
docker.mycompany.com/myusername/myrepository/business-services latest aaaaaaaaaaaa 3 hours ago 120MB
openjdk 8-jdk-alpine 04060a9dfc39 2 weeks ago 103MB
and then try to push it like this
docker push docker.mycompany.com/myusername/myrepository/business-services
The push refers to repository [docker.mycompany.com/myusername/myrepository/business-services]
denied: requested access to the resource is denied
so its confusing the repository name
I did it this way too, just to make sure
docker push docker.mycompany.com/myusername/myrepository/business-services:latest
The push refers to repository [docker.mycompany.com/myusername/myrepository/business-services]
denied: requested access to the resource is denied
same error :(
Then I tried this:
docker tag business-services:latest docker.mycompany.com/business-services:latest
docker push docker.mycompany.com/business-services:latest
The push refers to repository [docker.mycompany.com/business-services]
denied: requested access to the resource is denied
That doesn't work because i'm not giving myuser/myrepository in the value.
Gaaaaaaaaaaa
This "mixture" of the remote url and the container name is driving me nuts.
At some point of trying to figure out the string voodoo, I got this error:
The push refers to a repository
An image does not exist locally with the tag:
What is the magic sauce for pushing to a url name like
docker.mycompany.com/myusername/myrepository
and who came up with this mix the target repository WITH the imagename voodoo?
Or am I completely off-base for how to push something to a internal company docker repository
RESEARCH stuff I found below:
https://docs.docker.com/engine/reference/commandline/push/#examples
Now, push the image to the registry using the image ID. In this
example the registry is on host named registry-host and listening on
port 5000. To do this, tag the image with the host name or IP address,
and the port of the registry:
$ docker tag rhel-httpd registry-host:5000/myadmin/rhel-httpd
$ docker push registry-host:5000/myadmin/rhel-httpd
Yes, I have researched this, thus how I got this far with my journey.
docker --version
Docker version 18.09.0, build 4d60db4
Thanks !!
Append
I followed these instructions:
http://karlcode.owtelse.com/blog/2017/01/25/push-a-docker-image-to-personal-repository/
under the "Push to your private repository" area.
Same error. can't find the URL
docker tag business-services docker.mycompany.com/myusername/myrepository/business-services:latest
docker push docker.mycompany.com/myusername/myrepository/business-services:latest
The push refers to repository [docker.mycompany.com/myusername/myrepository/business-services]
denied: requested access to the resource is denied

Do you have any other images from this repository? check the tags and make yours similar. Anyway, it is your company internals, it could be configured in different ways and better to ask internal guys who support this repo. Also, ask them to check your permissions.
for example, in my case works something like artifactory.company.com:10001/myusername/virtualreponame/imagename:latest
but in your case, it could be completely differ

So I finally got this to work
docker tag business-services
docker.mycompany.com/myusername/business-services:latest
docker push docker.mycompany.com/myusername/business-services:latest
It looks like the "short name" (in this case "business-services")... ~becomes~ the repository name. Or something like that.
and the repository on the docker trusted repository shows up as:
https://docker.mycompany.com/repositories/myusername/business-services
Anyways. It looks silly now. I hope that helps someone in the future.

Related

Docker Desktop Push of Image to Private Repo Fails

I have Docker Desktop, but create my images on a Linux ARM64 machine, not the MacBook with the Docker Desktop application on it. I want to push these ARM64 images from the Linux host itself, but have run into the following problem:
When I push my image to my Docker Hub private repo with the command:
docker push myDockerHubUserName/myPrivateRepoName:tagOfImage
It fails with the error:
invalid reference format
The form of the command Docker has provided in my Docker account is described as:
Docker commands
To push a new tag to this repository,
docker push myDockerHubUserName/myPrivateRepoName:tagname
I've double-checked the values and syntax: ALL are 100% correct. But the push nonetheless fails.
How is this broken?!?!
Intro:
The error:
invalid reference format
is actually a red herring that will mislead you into believing that there is a syntax error in your push command when there isn't and you'll waste your time...
Problem:
Feel free to jump to the "SOLUTION" section below if you don't care how the commands fails and just want to know how to make it execute successfully ;-)
The instructions for pushing the image that Docker provides in their user's accounts have some large & material gaps. You will waste your time- a fair bit of it- if you do not have the following context:
You must login to your Docker Account before trying to push anything to it:
docker login -u yourDockerAccountUsername
The command Docker Hub gives you implies that the image you're trying to push was already TAGGED with the private repo as part of the tag itself.
It just appears to be a string comprised of (3) parts:
<dockerUserName>/<privateRepoName>:<tagname>It is NOT. You CANNOT merely concatenate
"myDockerHubUserName/myPrivateRepoName"
with
"tagname"
delimited with a colon! "myDockerHubUserName/myPrivateRepoName" must itself be part of the tag or the command will fail!!!
This "help" from Docker I found to be worse than giving no "help" at all because it served to create undue confusion. This is absolutely fundamental stuff and deserves better treatment.
Solution:
Login to your Docker Account:
docker login -u yourDockerAccountUsername
Get the Image ID for the Image that you want to push:
docker image ls
Tag the image with your Docker Hub User ID, Docker Hub Repo Name AND Image Name:
docker tag ae1b95b73ef7 myDockerHubUserName/myPrivateRepoName:myImageName
Push the Image:
docker push myDockerHubUserName/myPrivateRepoName:myImageName
Note the COLON separating the repo & image name: I've seen this described as a forward slash in other answers but I found a colon is required for the command to succeed.
Conclusion:
This was a big and unnecessary time-waster that sent me down the rabbit hole. Hopefully this answer will save others wasted time.
Attribution:
This answer was actually pieced together from several different Stack questions which got me across the finish line. Kudos to Abhishek Dasgupta for the general procedure & kudos to Илья Хоришко for the form of the tag which worked in the end. You folks are stars!

JFrog Artifactory error: Pushing Docker images with manifest v2 schema 1 to this repository is blocked

I have two docker repositories running on the same JFrog cloud account/instance. One for internal release candidates and the other for potentially external GC releases. I want to be able to build the docker images and push to the internal repository, let QA/UAT go to town, and then copy the image to the release repository. I don't want to rebuild the image from source. Unfortunately, when I try to pull, tag and then push the image, I'm getting an error:
unauthorized: Pushing Docker images with manifest v2 schema 1 to this repository is blocked.
Both repositories block schema 1 manifests, but I am pushing fine to the internal repository, so it doesn't make much sense I wouldn't be able to push the same image to the release repository.
I've setup a pretty simple test to confirm (actual repository URLs censored):
% docker pull hello-world:latest
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete
...
% docker tag hello-world:latest internal-rc.jfrog.io/hello-world:1.0.0-beta
% docker push internal-rc.jfrog.io/hello-world:1.0.0-beta
The push refers to repository [internal-rc.jfrog.io/hello-world]
9c27e219663c: Pushed
...
% docker system prune -a
...
Total reclaimed space: 131.8MB
% docker image pull internal-rc.jfrog.io/hello-world:1.0.0-beta
1.0.0-beta: Pulling from hello-world
0e03bdcc26d7: Pull complete
...
% docker image tag internal-rc.jfrog.io/hello-world:1.0.0-beta docker-release.jfrog.io/hello-world:1.0.0
% docker image push docker-release.jfrog.io/hello-world:1.0.0
The push refers to repository [docker-release.jfrog.io/hello-world]
9c27e219663c: Layer already exists
[DEPRECATION NOTICE] registry v2 schema1 support will be removed in an upcoming release. Please contact admins of the docker-release.jfrog.io registry NOW to avoid future disruption. More information at https://docs.docker.com/registry/spec/deprecated-schema-v1/
unauthorized: Pushing Docker images with manifest v2 schema 1 to this repository is blocked. For more information visit https://www.jfrog.com/confluence/display/RTF/Advanced+Topics#AdvancedTopics-DockerManifestV2Schema1Deprecation
So I can upload the image fine to the first repository, and confirm that it is using schema 2:
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"config": {
"mediaType": "application/vnd.docker.container.image.v1+json",
"size": 7004,
"digest": "sha256:66f750f4871ba45724699d7341ee7135caba46f63fb205351197464a66b55eff"
...
Does that mediaType being v1 matter? It seems like the manifest itself is version 2... But I don't know how I would change that, or why it would be allowed in one repository but not the other.
I'm using I believe the latest version of docker Docker version 19.03.8, build afacb8b
Anyone have any idea what's going on there? Is the schema version being changed between when I upload it the first time and when I download it? Or is it when I tag it or upload it the second time?
The root of this problem can probably be classified as user error. Specifically the user I'm using somehow had permissions removed from the release repository. Once that was restored everything works as expected.
I say "probably" because the error message has nothing to do with the actual problem, and cost me 2-3 hours worth of wild goose chasing.
So... If you see this error, go ahead and double check everything else around permissions/access before trying to figure out if there's something actually wrong with your image schema version.
We had a different case today with a similar error. I'm adding here because this is the top google result at the moment.
Pulling Docker images with manifest v2 schema 1 to this repository is blocked.
The fix was to change a setting on the remote repository.
Via UI:
Artifactory Admin -> Repositories -> Repositories -> Remote tab
Then select your Docker Hub repo, whatever you named it, then under Basic settings -> Docker Settings, uncheck the checkbox labeled
Block pulling of image manifest v2 schema 1
After that our images began pulling properly again.
There is a similar checkbox on local repos for pushing.
For what it's worth, we're on Artifactory version 7.18.5 rev 71805900
edit: The surprisingness of our particular issue is (potentially) explained in some more detail here: https://www.jfrog.com/jira/browse/RTFACT-2591
Docker pull requests fail due to a change in Docker Hub behavior. Now Docker Hub HTTP response headers return in lower case, for example, 'content-type' instead of 'Content-Type', causing Artifactory to fail to download and cache Docker images from Docker Hub.
but we have not yet tested whether an upgrade allows us to re-enable the aforementioned checkbox.
I have been getting the below errors while either pulling or pushing docker images from build servers. i have a proxy in env which used to connect docker registry. My DNS server while resolving the proxy FQDN it was returning a non functional IP-address. i have 4 DNS servers and multiple proxy servers based on region. Once DNS is updated and working/functional proxy returned it started working. Just check on network side too , it may solve the issue. the error messages were misleading initially i though to be docker layer issue, credential issue ..but no network issue. for the below errors
error pulling image configuration: unknown blob or
[DEPRECATION NOTICE] registry v2 schema1 support will be removed in an upcoming release. Please contact admins of the docker registry NOW to avoid future disruption. More information at https://docs.docker.com/registry/spec/deprecated-schema-v1/
manifest invalid: manifest invalid
. Will start No.6 try.

Pulling Docker Images - Manifest not found

I'm trying to download a tagged docker image
docker pull clkao/postgres-plv8:10-2
and, in a compose file,
postgres:
image: clkao/postgres-plv8:10-2
But receive a manifest not found exception.
Unless I'm mistaken, that tag exists in Docker Hub, however I notice that it doesn't appear on the tags list.
Am I doing something wrong? Or is this perhaps an issue with Docker Hub or the way that repo has been set up?
If it isn't 'my fault', what's a recommendation to move forward? Create my own Dockerfile perhaps?
You might also try
docker pull -a <image>.
The -a will pull all versions of that image, which at least lets you know what is there.
(This is less useful if you really need a specific version, but helped me when I tried to pull an image that for some reason did not have a 'latest' tag.)
Edit: This is actually a really bad idea, since it will pull down the entire history, which for many repositories could be many GB. Better to go look at the repository site and see what tag you want. Note to self: don't post answers when you are tired. :-(
You get the error message because there exist no tag with "10-2".
You can try to figure out why and contact the repository owner or you can try to build your own one.
I just got over this "manifest for / not found: manifest unknown: The named manifest is not known to the registry."
Using
docker login <repo>
Check the docker's image also not only that the tag exists, I was trying to run Flyway version 5.0.1 for an image flyway/flyway which version did not exist, it existed only in version flyway/flyway:latest it seems, whereas 5.0.1 existed and I pulled it but in/from a different repository name, with repository name boxfuse/flyway.
for the error message 'docker manifest unknown'
When you use docker pull, without a tag, it will default to the tag :latest. Make sure that when we are building a image add tag latest or we can access the image by the tag name after image name with colon
I think you are trying to tag your image as v8.10.2. Make sure while tagging image locally you use same tag which you want to pull in future. So steps will be like below:
docker build -t clkao/postgres-pl:v8.10.2 .
docker push clkao/postgres-pl:v8.10.2
docker pull clkao/postgres-pl:v8.10.2
If this is from Git via docker.pkg.github.com then you need to switch to use ghcr.io. The former is deprecated and does not support the manifest endpoint so some docker clients, when they attempt to download various resources, fail with this error message. If you instead publish your image to ghcr (Github Container Repository), the docker image pulling process should complete successfully.
cd <dir with Dockerfile in it>
docker build -f Dockerfile -t ghcr.io/<org_id>/<project_id>:<version> .
docker push ghcr.io/<org_id>/<project_id>:<version>
More info here: https://docs.github.com/en/packages/working-with-a-github-packages-registry/migrating-to-the-container-registry-from-the-docker-registry
Note: The Container registry is currently in public beta and subject
to change. During the beta, storage and bandwidth are free. To use the
Container registry, you must enable the feature preview. For more
information, see "Introduction to GitHub Packages" and "Enabling
improved container support with the Container registry."

docker push error "denied: requested access to the resource is denied"

This error occurs when trying to push an image to the public repository on Docker Hub. There have been no issues with other registries I have tried.
I have looked at numerous sites, blogs including StackOverflow and there is still no clear answer.
You can try to replicate this issue as follows.
As shown in the screenshot above, I have an image aspc-mvc-app on local docker host. As shown, it has 3 tags - 1.0.5, 1.0.5.latest and latest.
Assume that we are trying to push using an account name of janedoe at Docker Hub
Per documentation on Docker.io and numerous other sites, there are 3 steps to pushing.
(1) Login
docker login "index.docker.io" -u janedoe -p <password>
--> I get Login Succeeded which is good!
(2) Add one or more tags
Of the 3 tags, let's just tag the latest.
docker tag janedoe/aspc-mvc-app:latest janedoe/aspc-mvc-app
--> The prompt returns with no error. So far so good.
(3) Push
docker push janedoe/aspc-mvc-app
--> This is where the error occurs.
As shown on the screenshot below, initial checks seem to occur fine until you get the error denied: requested access to the resource is denied
At step (2), I have tried numerous other formats including the following.
docker tag janedoe/aspc-mvc-app:latest janedoe/aspc-mvc-app:latest
docker tag janedoe/aspc-mvc-app janedoe/aspc-mvc-app:latest
docker tag aspc-mvc-app:latest janedoe/aspc-mvc-app
docker tag aspc-mvc-app janedoe/aspc-mvc-app:latest
docker tag 306a8fd79d88 janedoe/aspc-mvc-app
docker tag 306a8fd79d88 janedoe/aspc-mvc-app:latest
All fail with the same error.
As a comparison, with the same exact image, I had no problem pushing to Azure Container Registry.
Since Docker Hub is so popular, can anyone shed light on what the mystery is, or if there is a detailed documentation anywhere?
Updated 5/9/2017
I am fairly up-to-date on docker cli and server versions. Right now, my cli is 17.05.0-ce-rc1 and server is 17.04.0-ce as shown below.
The solution is simply to change the way of logging in at step (1).
docker login -u janedoe -p <password>
Everything else can stay the way described above. The image was successfully pushed to Docker Hub!
First login by typing sudo docker login in the terminal. Enter username and password
Visit your docker account and create a new repository. In my case I created a repository crabigator1900/dockerhub
Say you have a docker image with repository name:crabigator/django and tag:latest.
In that case you will need to tag this image with a label of your wish. I decided to tag it with the label:myfirstimagepush. You tag the image by typing the command
sudo docker tag crabigator/django:latest crabigator1900/dockerhub:firstimagepush
Finally push the image to your repo using the command
sudo docker push crabigator1900/dockerhub:firstimagepush
That's all there is to it.
I too had the same issue, but after trying some combinations this worked.
Whenever you push - that refers to docker.io/ followed by registry path.
In my case my username is rushmith and I created a sample repository called docker under rushmith.
My link is : "hub.docker.com/r/rushmith/docker/"
Now I created a tag to my image that I want to push as: rushmith/docker
And It worked successfully.
$ docker login -u rushmith
(Give the password then type as below)
$ docker push rushmith/docker:latest
Output:
The push refers to a repository [docker.io/rushmith/docker]
7fbb0e1e64cb: Pushed
33f1a94ed7fc: Pushed
b27287a6dbce: Pushed
47c2386f248c: Pushed
2be95f0d8a0c: Pushed
2df9b8def18a: Pushed
latest: digest:
sha256:4d749d86b4a2d9304a50df474f6236140dc2d169b9aabc354cdbc6ac107390f2 size: 1569
I hope this late solution might help someone.
The reason of this error message was you haven't named your images properly.
Let say your account name on docker.io was your-name then your new repo name is going to be your-name/your-new-image-name.
In order to push your image, first you have to tag (name) your local images as:
docker tag local-image[:tag-name] your-name/your-new-image-name[:tag-name]
Things in the brackets is optional. You may want to check the result with docker image ls. Then let push your image to your docker repo:
docker push your-name/your-new-image-name[:tag-name]
Done! Your image was pushed to docker repos.
You can follow the following steps:
Step 1: docker login -u <username> -p <password>
A message with "Login Succeeded" will appear, confirming your successful login.
Step 2:
Now in order to push the image just make sure the path which you are using must have your username included in the tag.
e.g: Suppose link is: "hub.docker.com/u/xyz/"
Create a tag to image as docker push xyz/docker:latest.
If you already have some different tag change it using command
docker tag <old tag> <new tag>
Hope this helps.
after 1 hour's struggling with different ways mentioned above,
I reinstalled the neweast version of Docker Desktop app in my mbp, then it is solved.
the neweast version is 20.10.2
and the old version is 17.x, which was installed 5 years ago.
First you need to ensure you have logged into your account
You need to create a repository, below is the command to create a repository -
docker tag local-image:tagname YOUR-ACCOUNT-NAME/tagname
docker push YOUR-ACCOUNT-NAME/tagname
Create a repository from a website.
It possible that you don't have a permission for creating repository.
docker push does not create a repo name so if not present it says access not available
This worked for me.
> docker login -u janedoe
Password:
Login Succeeded
> docker tag myapp:0.0.1 janedoe/myflinkapp:0.0.1
> docker push janedoe/myapp:0.0.1
The push refers to repository [docker.io/janedoe/myapp]
b763be657a2c: Pushed
e534dae385a8: Pushed
5af3d5d57035: Pushed
0e44828b51e2: Pushed
fdd771f27095: Pushed
ef9a7b8862f4: Pushed
a1f2f42922b1: Pushed
4762552ad7d8: Pushed
0.0.1: digest: sha256:0069ee2c39b422e64f0493d2b2e9cbe7736a size: 2154
In my case, I was facing this issue even after logging into Docker registry successfully.
So, I tried running the docker push as sudo and it worked.
Make sure you follow these steps:
Run docker login
After logging in successfully, run the docker push command
If the push failed, run this: sudo docker push repoName:tagName
If you're using 2FA and run
docker login -u <your_docker_user_name>
you will get Login successful but you won't be able to push.
This is because you're using 2FA which requires one-time password to login into your account.
To be able to push with 2FA enabled you need to use an access token. To generate one go to Account settings/Security on Docker Hub website and click New Access Token. As of Access Permissions preferably choose Read & Write - this is the entry level for being able to push. Only generate Read, Write, Delete token if you really need it!
You'll be prompted with instructions on what to do next. Just to keep the answer full, you'll have to run
docker login -u <you_docker_username>
and when prompted for Password paste your Personal Access Token.
IMPORTANT: save your Personal Access Token in a password manager and never share with anyone and never push to github or add to your source code. NEVER! Please.
Now, when you run docker push <your_docker_username>/<your_docker_repo_name>:<tag_of_your_image> you should be able to push the image to the Docker Hub.
I have the same problem and it was solved by running the push command with sudo. I think it is only a privilege problem.
sudo docker push janedoe/aspc-mvc-app

Why is my Docker image not being pushed to Docker Hub?

I have a Docker image that I'd like to push to Docker Hub:
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
mattthomson/hadoop-java8 0.1 d9926f422c14 11 days ago 857.9 MB
```
I've run docker login, logged in as mattthomson, and run docker push mattthomson/hadoop-java8:0.1. This takes a while, showing a progress bar of the upload.
However, it seems not to have worked. If I run docker pull mattthomson/hadoop-java8:0.1 from another computer, I get "Tag 0.1 not found in repository mattthomson/hadoop-java8". The images doesn't show up here, either.
What am I doing wrong?
I had to confirm my email address so my repositories show up on docker hub. Simple but didn't notice at first.
I experienced this when my Docker Hub organisation had reached its limit on the number of private repositories I was allowed to create (and I also got an email from Docker Hub about reaching this limit).
To solve the problem I upgraded my Docker Hub subscription to allow more repositories.
It would be nice if the error message from Docker Hub contained some hint to the cause.
I retried a number of times before this went through successfully. I was misled by the fact that the upload was failing partway through, without displaying an error message, just a timestamp. The error code was non-zero.

Resources