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.

  • How to identify orphaned veth interfaces and how to delete them?
  • Dockerfile COPY file into right container
  • Azure App hosted docker port 25
  • Error using Django with Docker - “Can't connect to MySQL server on '' (111)”)
  • get docker images command's output with bash script
  • How to copy large files into Docker image without saving in history
  • 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?

  • Unable to start Elastic Beanstalk MultiContainer instance
  • Cannot delete files on docker host
  • How to run Docker container from Java project?
  • Not able to install the gem “rmagick” with docker
  • unable to pass -t -i options to docker on ubuntu …am i missing something?
  • How to scale application with multiple exposed ports and multiple volume mounted by using docker swarm?
  • 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.