Push to Docker private registry from inside a docker

495 Views Asked by At

I have a Jenkins docker container which has access to main docker socket by mapping its volume described here. so I want to push an image to local docker private registry container which as described here, image should be tagged by host name like this:

docker tag ubuntu:16.04 localhost:5000/my-ubuntu

localhost is not known inside docker but by using docker gateway ip, docker push image to https and I get this error:

+ docker push 172.17.0.1/myalpine
The push refers to repository [172.17.0.1/myalpine]
Get https://172.17.0.1/v2/: read tcp 172.17.0.1:34956->172.17.0.1:443: read: connection reset by peer

Any idea of how to make it not use https or other solution?

1

There are 1 best solutions below

0
On

If you want to run the connection insecure, you can edit the file /etc/docker/daemon.json and include the following content in it:

{
    "insecure-registries" : [ "172.17.0.1:5000" ]
}