Some times it's required to copy a docker container between machines, or even developers. One option is to use a hosted repository and pay some money for this opportunity. Another option is to use a machine that has a reachable IP address and Docker to run a private and secure Docker Registry.
In this example we have a Linux VM somewhere on the network or Internet. That VM will accept ssh connections from us.
First we set up a ssh forwarding tunnel.
$ ssh -L 5000:localhost:5000 YOUR_VMS_IP_HERERun a Docker Registry container in your VM.
From a shell in your VM, run:
If we want to share a container with state, stop it and commit it. Lets say we want the image to have the name Dolly.
Back in a shell on your local machine, run:
Alternatively, if we want to share a local image:
Then finally, push the image to the VM.
$ docker push localhost:5000/DollyNow you can set up a tunnel from your other machine (or the other developer(s) can do that) and just pull it or run it.
And that's it.