Setting up Apache to work with multiple Docker repositories
To have multiple docker repositories in Artifactory, you’ll need to setup different SSL ports (e.g have several VirtualHosts) on your Apache configuration. For example, your default-ssl.conf file may look similar to this –
<VirtualHost *:443>
ServerName dockerone.com
SSLEngine on
SSLCertificateFile /etc/ssl/certs/docker-registry
SSLCertificateKeyFile /etc/ssl/private/docker-registry.key
ProxyRequests off
ProxyPreserveHost on
ProxyPass / http://localhost:9999/artifactory/api/docker/docker-local/
ProxyPassReverse / http://localhost:9999/artifactory/api/docker/docker-local/
</VirtualHost>
<VirtualHost *:442>
ServerName dockertwo.com
SSLEngine on
SSLCertificateFile /etc/ssl/certs/docker-registry
SSLCertificateKeyFile /etc/ssl/private/docker-registry.key
ProxyRequests off
ProxyPreserveHost on
ProxyPass / http://localhost:9999/artifactory/api/docker/docker-local-2/
ProxyPassReverse / http://localhost:9999/artifactory/api/docker/docker-local-2/
</VirtualHost>
To use a non-standard SSL port on a VirtualHost (like 442 in the above example), it is also required to add this to your /etc/apache2/ports.conf file with –
NameVirtualHost *:442
Listen 442
Finally, you need to setup your .dockercfg to manage your credentials per each of the registries, e.g –
{
"https://localhost:442" : {
"auth" : "YWRtaW46QVAzSEZ4UnFhemhoUzlVV2trTFZCMnNHTmlE",
"email" : ""
},
"https://localhost:443" : {
"auth" : "YWRtaW46QVAzSEZ4UnFhemhoUzlVV2trTFZCMnNHTmlE",
"email" : ""
}
}