I'm just going to put this here, because it was very difficult to find information on this topic and I ended up solving it myself.
Setup
- Bastion host in aws with a public ip address
- Registry (image registry:2) on a private subnet behind bastion host
- Successful ssh port forwarding through bastion, connecting localhost:5000 to registry:5000
curl localhost:5000/v2/_catalog
provides a list of installed registries.
So far so good.
docker tag {my image} localhost:5000/{my image}
docker push localhost:5000/{my image}
Result
The push refers to repository [localhost:5000/{my image}]
Get http://localhost:5000/v2/: dial tcp 127.0.0.1:5000: connect: connection refused
How do we connect to a registry port forwarded to localhost?