aiodocker
aiodocker copied to clipboard
Missing protocol scheme in docker_host. When I use a lot of certificaties
Missing protocol scheme in docker_host.
Hello,
Background
I have a lot of servers, which I need to manage with cert in different dir.
This method: def _docker_machine_ssl_context() just allow get CERT only from this os.environ.get("DOCKER_CERT_PATH", None) path.
So when I want to use many cert from different directory I prepare custom ssl.SSLContext with path, which I need.
Issue
But here some issue with this part of code:
if _rx_tcp_schemes.search(docker_host):
if os.environ.get("DOCKER_TLS_VERIFY", "0") == "1":
if ssl_context is None:
ssl_context = self._docker_machine_ssl_context()
docker_host = _rx_tcp_schemes.sub("https://", docker_host)
_rx_tcp_schemes
check for http or tcp, if I set up https, I will get ValueError("Missing protocol scheme in docker_host.")
error.
Because there are not https scheme in if else statement.
If I use http instead(to pass this if statement), when will create connection to docker, I will get: used http instead https scheme
So there are no way to do custom ssl.SSLContext with https scheme rn. In my problem, I just changed indent of one line.
if _rx_tcp_schemes.search(docker_host):
if os.environ.get("DOCKER_TLS_VERIFY", "0") == "1":
if ssl_context is None:
ssl_context = self._docker_machine_ssl_context()
docker_host = _rx_tcp_schemes.sub("https://", docker_host) #this one
May be it will be helpfull, Thanks!