Skip to content

Instantly share code, notes, and snippets.

@bsitruk
Created September 12, 2019 13:15
Show Gist options
  • Save bsitruk/f50be47d70e48ed0abb0bf0322bad0de to your computer and use it in GitHub Desktop.
Save bsitruk/f50be47d70e48ed0abb0bf0322bad0de to your computer and use it in GitHub Desktop.
Commands and configuration file to configure docker registry
# Run a docker registry
# https://docs.docker.com/registry/deploying/
docker run -d -p 5000:5000 \
--restart=always \
--name registry\
-v /mnt/registry:/var/lib/registry \
-e REGISTRY_HTTP_ADDR=0.0.0.0:5000 \
registry:2
# Add private registry as insecure
# https://docs.docker.com/registry/insecure/
Edit the daemon.json file, whose default location is /etc/docker/daemon.json on Linux
{
"insecure-registries" : ["myregistrydomain.com:5000"]
}
# Add proxy configuration
# https://serverfault.com/questions/803333/docker-private-registry-docker-push-is-forbidden
Edit /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://proxy:3128"
Environment="NO_PROXY=localhost,127.0.0.0/8"
# Restart docker service
systemctl daemon-reload
sudo service docker restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment