-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Docker module not compatible with private registry and internal/self-signed SSL certificate #257
Comments
After some research I've discovered that kennethreitz/requests#1347 fixes this issue for me because I was hosting two SSL sites on one machine. |
hey @mattupstate I am having this same issue and I don't know if I have configured my Nginx incorrectly. Could you tell me how you fixed it? :) |
@lenfree The issue does not reside with Nginx. It resides with Python not supporting SNI out of the box. I've forgone deploying private registry images with Ansible because of this. |
Hi @mattupstate, I installed the below packages for the SNI support, but I am still having the same error. I have port 80 redirected to port 443, disabled authentication as well. hmm.. pyopenssl |
tried to debug the code, and the issue is when it is doing a check if utils.ping('https://' + hostname + '/v1/_ping'): and this function is making an https requests but it can't find the cert. requests.get('my.registry', timeout=3) Furthermore, I did an strace on the request, and it reads this cacert file: /usr/lib/python2.6/site-packages/requests/cacert.pem Is there a config somewhere that we can specify where the cert path is? |
@lenfree Thats exactly right, thats why I stopped/can't use Ansible to deploy private Docker images right now. Unless there is some way to set one of two environment variables during the context of an Ansible task, you're out of luck. I haven't figured out how to do that. What I thought would work was adding our private CA cert to the system bundle, but it appears that the The official Docker client/cli, behaves differently. If you don't already know, you must place your private CA certificate in a predictable folder. That folder is:
|
the environment directive allows you to set CURL_CA_BUNDLE and REQUESTS_CA_BUNDLE |
Issue Type:
Bug Report
Ansible Version:
1.7.2
Environment:
Ubuntu 14.04
Summary:
I've deployed a private Docker registry, configured such that non-volatile requests (GET, OPTIONS) do not require authentication. However, pushing images does require authentication and the Docker CLI requires that the connection be HTTPS when it has to send credentials. So I've configured the registry as such and I've added my internal CA to the system certificates. Now I can run normal Docker CLI commands without any SSL problems.
However, I believe therein lies a problem with the usage of the docker-py library. The docker-py library uses the requests library to interact with the registry. Additionally, requests vendors its own CA bundle effectively making my change to the system certificates mute. requests does support some environment variables, such as REQUESTS_CA_BUNDLE to point to a different bundle. In a naive attempt to fix this I added REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt to /etc/environment but that didn't work.
So I'm not sure if this can be solved here, perhaps it can and makes sense, but perhaps its also partly a problem with docker-py. There is an issue that might be related on that project as well: docker/docker-py#317
Steps To Reproduce:
docker
module to run a container from an internal registry image:Expected Results:
A running Docker container
Actual Results:
The text was updated successfully, but these errors were encountered: