{"id":3113,"date":"2015-01-21T23:52:01","date_gmt":"2015-01-21T22:52:01","guid":{"rendered":"https:\/\/www.devco.net\/?p=3113"},"modified":"2015-01-22T00:49:53","modified_gmt":"2015-01-21T23:49:53","slug":"running-a-secure-docker-registry-behind-apache","status":"publish","type":"post","link":"https:\/\/www.devco.net\/archives\/2015\/01\/21\/running-a-secure-docker-registry-behind-apache.php","title":{"rendered":"Running a secure docker registry behind Apache"},"content":{"rendered":"
I host a local Docker registry and used to just have this on port 5000 over plain http. I wanted to put it behind SSL and on port 443 and it was annoying enough that I thought I’d write this up.<\/p>\n
I start my registry pretty much as per the docs:<\/p>\n
\r\n% docker run --restart=always -d -p 5000:5000 -v \/srv\/docker-registry:\/tmp\/registry --name registry registry\r\n<\/pre>\nThis starts it, ensure it stays running, makes it listen on port 5000 and also use a directory on my host for the file storage so I can remove and upgrade the registry without issues.<\/p>\n
The problem with this is there’s no SSL and so you need to configure docker specifically with:<\/p>\n
\r\ndocker -d --insecure-registry registry.devco.net:5000\r\n<\/pre>\nAt first I thought just fronting it with Apache will be as easy as:<\/p>\n
\r\n\r\n ServerName registry.devco.net\r\n ServerAdmin webmaster@devco.net\r\n\r\n SSLEngine On\r\n SSLCertificateFile \/etc\/httpd\/conf.d\/ssl\/registry.devco.net.cert\r\n SSLCertificateKeyFile \/etc\/httpd\/conf.d\/ssl\/registry.devco.net.key\r\n SSLCertificateChainFile \/etc\/httpd\/conf.d\/ssl\/registry.devco.net.chain\r\n\r\n ErrorLog \/srv\/www\/registry.devco.net\/logs\/error_log\r\n CustomLog \/srv\/www\/registry.devco.net\/logs\/access_log common\r\n\r\n ProxyPass \/ http:\/\/0.0.0.0:5000\/\r\n ProxyPassReverse \/ http:\/\/0.0.0.0:5000\/\r\n<\/VirtualHost>\r\n<\/pre>\n