Unable to push image to docker hub - docker

I have built a docker image and have committed the changes, and am attempting to push the image to my public docker hub account.
When attempting to push the image to the docker hub registry it seems to try utilise my hub username as a private server address.
What i have done done so far is run a fedora base image, make my changes and then commit the changed using docker commit dd09de55abc9 username/fedora-23-httpd
When i do this and check the image using docker images i get the output:
# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
/username/fedora-23-httpd latest 0b9b4d0b820e 21 seconds ago 468.5 MB
Then when running docker push username/fedora-23-httpd i get the message:
The push refers to a repository [username/fedora-23-httpd] (len: 1)
unable to ping registry endpoint https://username/v0/
v2 ping attempt failed with error: Get https://username/v2/: dial tcp: lookup username: No address associated with hostname
v1 ping attempt failed with error: Get https://username/v1/_ping: dial tcp: lookup username: No address associated with hostname
From other tutorials I have read my commands appear to be correct, but the output of the images command shows the repository name with a / at the start.
Can any one see what i'm doing wrong here?

removed default docker version from fedora 23 install - reinstalled using
wget -qO- https://get.docker.com/ | sh

Related

Microk8s trouble launching local docker image

I'm using the latest version of microk8s and docker on the same VM. microk8s registry is enabled.
I restaged my image argus
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
argus 0.1 6d72b6be9981 3 hours ago 164MB
localhost:32000/argus registry 6d72b6be9981 3 hours ago 164MB
then I pushed it
$ docker push localhost:32000/argus:registry
The push refers to repository [localhost:32000/argus]
c8a05c6fda3e: Pushed
5836f564d6a0: Pushed
9e3dd069b4a1: Pushed
6935b1ceeced: Pushed
d02e8e9f8523: Pushed
c5129c726314: Pushed
0f299cdf8fbc: Pushed
edaf6f6a5ef5: Pushed
9eb034f85642: Pushed
043895432150: Pushed
a26398ad6d10: Pushed
0dee9b20d8f0: Pushed
f68ef921efae: Pushed
registry: digest: sha256:0a0ac9e076e3249b8e144943026bc7c24ec47ce6559a4e087546e3ff3fef5c14 size: 3052
all working seemingly fine but when I try to deploy a pod with:
$ microk8s kubectl create deployment argus --image=argus
deployment.apps/argus created
$ microk8s kubectl get pods
NAME READY STATUS RESTARTS AGE
argus-84c8dcc968-27nlz 0/1 ErrImagePull 0 9s
$ microk8s kubectl logs argus-84c8dcc968-27nlz
Error from server (BadRequest): container "argus" in pod "argus-84c8dcc968-27nlz" is waiting to start: trying and failing to pull image
The image can not be pulled, I tried the $ microk8s ctr images ls but this does not tell me anything.
So what is it that I'm doing wrong here?
update:
A bit of an update here when I try:
$ microk8s ctr image pull localhost:32000/argus:registry
ctr: failed to resolve reference "localhost:32000/argus:registry": failed to do request: Head "https://localhost:32000/v2/argus/manifests/registry": http: server gave HTTP response to HTTPS client
So it seems that it does not like that it gets and http response from my local repository. I looked into the config at /var/snap/microk8s/current/args/containerd-template.toml and there the localhost repository is correctly configured:
[plugins."io.containerd.grpc.v1.cri".registry]
# 'plugins."io.containerd.grpc.v1.cri".registry.mirrors' are namespace to mirror mapping for all namespaces.
[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
endpoint = ["https://registry-1.docker.io", ]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:32000"]
endpoint = ["http://localhost:32000"]
I'm running all of this on a centos8 VM. When I installed docker
I needed to do it with sudo dnf install docker-ce --nobest because otherwise there was some kind of conflict with containerd maybe it has todo something with this?
Okay, there were multiple issues at play here, and I think I solved them all. First of, I made a mistake with the Docker Image. It was a test image, but it should have had something that continuously runs because after PID 1 ends the container gets restarted, the reasons is that microk8s/kubernetes assumes a there is a problem. That's why there was the crash loop.
Second, to check which repositories are present in the local registry, it's easiest to curl the rest API of the registry with:
$curl http://host:32000/v2/_catalog
to get a list of all images, and:
$curl http://host:32000/v2/{repositoryName}/tags/list
to get all tags for a given repo.
Lastly, to pull from the registry to the cluster manually without getting the https error, it's necessary to add the --plain-http option like this:
$microk8s ctr image pull --plain-http localhost:32000/repo:tag
you can use kubectl describe to check the pod
i guess it try to pull the "argus" from docker.io
have you try add localhost:32000 to the image parameter?
microk8s kubectl create deployment argus --image=localhost:32000/argus:registry

How do I push a Docker Image in Virtual Box to Google repository?

I have a virtualbox development:
$docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
development - virtualbox Running tcp://*.*.*.*:**** v18.05.0-ce
Inside development I have this:
$docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest e1ddd7948a1c 1 day ago 1.16MB
pritam/play-docker latest 34eb2664f14e 1 day ago 1.4GB
Now I want to push this image inside virtual box to google repository. How do I that?
you can use docker push command
docker push imageTagName
http://docs.docker.com/engine/reference/commandline/push
For your own registry you can use
docker push registry.example.com/image
http://blog.docker.com/2013/07/how-to-use-your-own-registry.
And for google container registry reference:
http://cloud.google.com/container-registry/docs/pushing-and-pulling
docker [push/pull] gcr.io/{PROJECT_ID}/{image}:tag
for authentication you can check google container registry reference
https://medium.com/google-cloud/using-googles-private-container-registry-with-docker-1b470cf3f50a
after you get google auth keys as json format (key.json)
docker login -u _json_key -p “$(cat key.json)”
after login success you can push your image
docker push gcr.io/project_id/imageName:tag

Creating tag for image pushing to repository

I have created repository in docker cloud andrejvi/andrejvi_repo and would like to place there image I have created.
Image name is dev_centos32
I do push:
sudo docker push andrejvi/dev_centos32
According to my understanding I must create tag for this image. How to do that?
Trying to push:
sudo docker push andrejvi/andrejvi_repo:dev_centos32
got error:
An image does not exist locally with the tag: andrejvi/andrejvi_repo:
UPD
I changed tag, but still can't push to repository
docker tag dev_centos32 andrejvi/andrejvi_repo/dev_centos32
sudo docker push andrejvi/andrejvi_repo/dev_centos32
The push refers to repository [docker.io/andrejvi/andrejvi_repo/dev_centos32]
0afb6e2f03f2: Preparing
d70d6ed6bc21: Preparing
denied: requested access to the resource is denied
UPD
Got error while login
$ sudo docker login andrejvi
Username: andrejvi
Password:
Error response from daemon: Get https://andrejvi/v2/: dial tcp: lookup andrejvi on 127.0.1.1:53: server misbehaving
denied: requested access to the resource is denied
You need to login into Docker Hub/Docker Cloud repository using the command:
docker login
Take a look at Push images to Docker Cloud.
Try:
docker login
docker tag dev_centos32 {docker-hub-username}/andrejvi/andrejvi_repo/dev_centos32
docker image push {docker-hub-username}/andrejvi/andrejvi_repo/dev_centos32

Access denied when pulling Docker image from a repository I own

I built a Docker image that I pushed to Docker Hub under my account and removed locally after. But when I try to pull it, it throws the following error:
Error response from daemon: pull access denied for mightyspaj/dockerfile-assignment-1, repository does not exist or may require 'docker login'
I'm logged into the same account that owns the repository for this image and can perform other tasks (such as pushing) perfectly fine. The repository also definitely exists on Docker Hub, yet it fails when I try to pull it.
I've tried the following things:
Logging out of my account and back in again
Renaming config.json and regenerating it
Running an isolated Docker container with docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock:ro docker sh, then logging into my account and attempting to pull the image
Deleting and recreating the repository
All of these things still produce the same error. I'm baffled.
To note, both my client and engine versions are 17.12.0-ce. My OS is Ubuntu 17.10 (64-bit).
Console output
docker login
-> % docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: mightyspaj
Password:
Login Succeeded
docker tag
-> % docker tag dockerfile-assignment-1:latest mightyspaj/dockerfile-assignment-1
docker push
-> % docker push mightyspaj/dockerfile-assignment-1
The push refers to repository [docker.io/mightyspaj/dockerfile-assignment-1]
8427a8e6a29f: Pushed
655a921743e8: Pushed
8aa44edb7524: Pushed
60f1a2dc4cd8: Mounted from library/node
9185fe936b87: Mounted from library/node
e53f74215d12: Mounted from library/node
latest: digest: sha256:6c68220ba84f13d0229ef4458f22369410bb98764b908a75be0849c3003de160 size: 1582
docker image rm
-> % docker image rm mightyspaj/dockerfile-assignment-1
Untagged: mightyspaj/dockerfile-assignment-1:latest
Untagged: mightyspaj/dockerfile-assignment-1#sha256:6c68220ba84f13d0229ef4458f22369410bb98764b908a75be0849c3003de160
docker image pull
-> % docker image pull mightyspaj/dockerfile-assignment-1
Using default tag: latest
Error response from daemon: pull access denied for mightyspaj/dockerfile-assignment-1, repository does not exist or may require 'docker login'
I could fix the same issue only when I made the repository public. Make sure the repository is public then this is the set of instructions I followed in command line:
Once logout from docker hub and login again.
1- docker logout
2- docker login --username=YOURUSERNAME
Enter password when asked
3- docker pull repositoryName"/"imageName[:tag]
if "tag" is not included the default value will be "latest".
Then check the images by docker images command to check if its been pulled.
After pulling is done I made the repository private again.
This solution is only valid on private docker repositories!!
First try to login on your private repo e.g:
docker login dockerrepo.example.com
Then
If you build new image with dockerfile based on image in your private repository then you must prefix your base image with private repository url:
FROM PRIVATE_REPO_URL + IMAGE_INFO
sample:
PRIVATE_REPO_URL --> dockerrepo.example.com
BASE_IMAGE --> samples/java/jdk:1.6
Your dockerfile look like this:
FROM dockerrepo.example.com/samples/java/jdk:1.6

Docker pull giving connection reset by peer error

I have installed Docker on Ubuntu machine. I have problem with docker pull command, I am getting connection reset by peer error.
root#machine1:~# docker pull ubuntu
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: read tcp 10.80.64.126:51404->54.152.209.167:443: read: connection reset by peer
command : docker images worked and gave empty result as no image is downloaded on docker host. But as this command is working, shows docker installed successfully.
REPOSITORY TAG IMAGE ID CREATED SIZE
My docker version is 1.13.1.
How can I solve this problem?

Resources