Push to port-forwarded docker registry


There is a private docker registry I have no control of. This registry is not accessible from my computer but is accessible from a remote server I have access to.

  • Elasticsearch 2.4 nodes does not form cluster with ConnectTransportException
  • Inconsistent runtime kernel parameters in DOCKER container and on host
  • Error running docker and nodemcu-build in linux (debian)
  • How to connect two docker containers through localhost?
  • Cannot get Jenkins Docker slave to build docker images
  • “python setup.py install” does not work from Dockerfile but i can go in the container and do the same..any pointers?
  • This is my current (quite inefficient) workflow:

    # On my machine
    $ docker save IMAGE > FILE
    $ scp FILE SERVER
    $ ssh SERVER
    # On the server
    $ docker load < FILE
    $ docker tag -f IMAGE REGISTRY:5000/IMAGE
    $ docker push REGISTRY:5000/IMAGE


    It takes forever to push the image as I need to save, upload and load the whole tarball even if there are no changes in most of the docker layers.

    I tried to use ssh to forward the docker registry port (5000) to a port on my machine:

    $ ssh -L 5042:REGISTRY:5000 SERVER

    Now I can communicate with the registry from my machine:

    $ curl localhost:5042/v2/

    But the docker wont push images to it:

    $ docker tag IMAGE localhost:5042/IMAGE
    $ docker push localhost:5042/IMAGE
    The push refers to a repository [localhost:5042/IMAGE] (len: 1)
    Sending image list
    FATA[0000] Put http://localhost:5042/v1/repositories/IMAGE/: dial tcp connection refused

    I have a feeling that the problem is in different name/tag of the image. On the server I need to tag it as REGISTRY:5000/IMAGE but on localhost it would make no sense as the REGISTRY url is not accessible from my computer.

    Or the problem may be caused by the fact that I am running docker through docker-machine.


    Can I somehow push to a private docker registry that is port-forwarded to a local port?

  • How to limit amount of running docker instances?
  • how to pass a --login into docker build
  • Docker mount dangling volume
  • how can I allow access to only one URL from a docker container
  • Jenkins with Docker plugin java.lang.NullPointerException: uri was not specified
  • Two versions of Docker data volumes on same machine?
  • One Solution collect form web for “Push to port-forwarded docker registry”

    There need to be two ssh tunnels. One from the local machine (this one is used by the docker client) and one from the docker-machine (this one is used by docker daemon).

    docker-machine ssh
    ssh -L 5042:REGISTRY:5000 SERVER
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.