I am trying to run a private docker registry using this tutorial. But after I did everything and run the docker-compose, I get the following error from the nginx
container
no "ssl_certificate_key" is defined for certificate
"/home/user/registry/nginx/ssl/key.pem"
Here is the registry.conf file:
upstream docker-registry {
server registry:5000;
}
server {
listen 80;
server_name example.com;
return 301 https://example.com$request_uri;
}
server {
listen 443 ssl http2;
server_name privatesecurereg.netspan.com;
ssl_certificate /home/user/registry/nginx/ssl/csr.pem;
ssl_certificate /home/user/registry/nginx/ssl/key.pem;
# Log files for Debug
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
location / {
# Do not allow connections from docker 1.5 and earlier
# docker pre-1.6.0 did not properly set the user agent on ping, catch "Go *" user agents
if ($http_user_agent ~ "^(docker/1.(3|4|5(?!.[0-9]-dev))|Go ).*$" ) {
return 404;
}
proxy_pass http://docker-registry;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 900;
}
}
What is the rpobelom and how to fix it ?
UPDATE:
Here is my docker-compose:
nginx:
image: nginx:alpine
container_name: nginx
restart: unless-stopped
tty: true
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/conf.d/:/etc/nginx/conf.d/
- ./nginx/ssl/:/etc/nginx/ssl/
networks:
- mynet
2
Answers
I think you had missed something in
docker-compose
file. This is working sample we use.Keep an eye on this part
Here
auth
folder has certificate and key file. Also httpd file for docker registry login.In
nginx.conf
we directly refered inside thenginx
container.You mount your certificate dir
/home/user/registry/nginx/ssl/
to/etc/nginx/ssl
in dockerTherefore in nginx config you need to use ssl files under
/etc/nginx/ssl
changefullchain.pem
orprivkey.pem
if needed, btw this is from the tutorial try to follow it