I am running a single node swarm, I am using traefik to manage all my external connections, and I want to run a registry such that I can connect to it at registry.myhost.com
Now all the examples I can see suggest creating a registry as a normal container rather than a service, however when I do this, I do not have the ability to add it to my traefik network and thus enable it to be found externally.
Do I need to create another internal network and connect both traefik and it to it, and if so, what type. Or do I need to run the registry as a service (I'm only on a single node so volume shouldnt be much of an issue).
And for bonus points, can anyone give me some pointers on how to set it up with s3 as a storage backend?
Overview
You have two machines:
I assume you have two certificate files:
registry.myhost.com.crt
registry.myhost.com.key
Server
Your server setup might look like this:
docker-compose.yml
traefik.toml
To deploy your registry run:
Add Another Stack
If your service is not defined in the same docker-compose.yml as traefik you can use the (external) network of the traefik service:
Make sure you add the certificate files of
whoami.myhost.com
to traefik.toml:or use a (single) wildcard certificate
*.myhost.com
See https://docs.traefik.io/configuration/entrypoints/ for further information.
Client
Copy
registry.myhost.com.crt
on your client machine to/etc/docker/certs.d/registry.myhost.com/ca.crt
on Linux or~/.docker/certs.d/registry.myhost.com/ca.crt
on Mac. Now you should be able to login from the client:Copy an image from Docker Hub to your registry
On your client run:
Now you can pull this image on another machine (for example on the server):
Don't forget to add
registry.myhost.com.crt
on that client machine, too.