Goal
Push local images from Docker Mac to a remote Docker registry running in a Kubernetes cluster on AWSSolution
Get ip of your machine (thats the one that docker engine can reach)
$ local_ip=$(ipconfig getifaddr en0)
Define registry.example.com as
local_ip registry.example.com
https://docs.docker.com/docker-for-mac/networking/#use-cases-and-workarounds
Tunnel:5000 to registry DNS
$ ssh -N -p 22 user@bastion -L local_ip:5000:registry.example.com:5000
$ docker push registry.example.com:5000/example-base
$ local_ip=$(ipconfig getifaddr en0)
Define registry.example.com as in /etc/hosts
Alias lo0 with registration.example.com defined as local_ip in hosts
https://docs.docker.com/docker-for-mac/networking/#use-cases-and-workarounds
I WANT TO CONNECT FROM A CONTAINER TO A SERVICE ON THE HOSTThe Mac has a changing IP address (or none if you have no network access). Our current recommendation is to attach an unused IP to the lo0 interface on the Mac; for example: sudo ifconfig lo0 alias 10.200.10.1/24, and make sure that your service is listening on this address or 0.0.0.0 (ie not 127.0.0.1). Then containers can connect to this address.$ sudo ifconfig lo0 alias registration.example.com/24
Tunnel
$ ssh -N -p 22 user@bastion -L local_ip:5000:registry.example.com:5000
Add local_ip:5000 to docker daemon config insecure registries;
save and restart docker daemonPush to registration.example.com
$ docker tag example-base registration.example.com:5000/example-base$ docker push registry.example.com:5000/example-base
References
https://github.com/moby/moby/issues/29608
https://docs.docker.com/docker-for-mac/networking/#use-cases-and-workarounds
https://docs.docker.com/docker-for-mac/networking/#use-cases-and-workarounds
Aucun commentaire:
Enregistrer un commentaire