HOWTO: Docker Swarm Insecure Private Registry

By | October 10, 2017

In this scenario, I wanted to run my own local repository without any bullshit ssh auth (it’s in my own house and not for my job so I can do whatever the fuck I want to) and store the repository data on my SAN (mounted as /data on all docker nodes).  The host docker01 is my swarm manager node.

# docker --version
Docker version 17.09.0-ce, build afdb6d4

# sudo echo '{"insecure-registries" : ["docker01:5000"]}' > /etc/docker/daemon.json
# sudo service docker restart
# docker service create --name=registry --mount source=/data/registry,target=/var/lib/registry,type=bind --publish 5000:5000 registry:2
# docker pull alpine
# docker tag alpine docker01:5000/alpine
# docker push docker01:5000/alpine

Please let me know if you run into any issues.  I had tons of problems getting a registry running using SSL, and the documentation for getting the volumes mounted under swarm were difficult to find, so hopefully this helps someone out.