0

I created a local docker repository in my server.
When I try to push the image into it, there is an error.
I need an HTTPS connection.
How do I get an HTTPS for my own docker registry?

os: ubuntu 16.x
Docker version: 18.06.1-ce, build e68fc7a
Already Tried:
Adding the below lines into /etc/docker/daemon.json,

{ "insecure-registries" : ["myregistrydomain.com:5000"] }

Expected: I should be able to push and pull images into my own server containing docker registry

AATHITH RAJENDRAN
  • 4,689
  • 8
  • 34
  • 58

2 Answers2

2

To avoid exposing your registry to the wider internet while still being able to pull images from it you can:

  1. Run a local registry on your dev machine, to which you push images
  2. ssh to your server with a reverse tunnel:

    ssh -R 5000:localhost:5000 myhost

    (listen on port 5000 of the remote machine (-R 5000) and tunnel back to localhost:5000 on the local machine)

  3. Now, on myhost you can docker pull localhost:5000/someImage, but it's actually seamlessly connecting through an encrypted tunnel back to the registry on your dev machine.

Chris
  • 3,445
  • 3
  • 22
  • 28
0

You can have a local unsecured registry. For that, you need to add an exception in your /etc/docker/daemon.json, this way

{
  "insecure-registries" : ["myregistrydomain.com:5000"]
 }

The same link shows how to use a self-signed certificate.

Eventually, using an actual certificate is juste a step further, but you may not need one for development purpose.

EDIT :
You need to restart your daemon after that :

service docker restart 
Marvin
  • 1,650
  • 4
  • 19
  • 41