Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing protocol scheme in docker_host. When I use a lot of certificaties #752

Open
horw opened this issue Nov 3, 2022 · 0 comments
Open
Labels

Comments

@horw
Copy link

horw commented Nov 3, 2022

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!

@achimnol achimnol added the bug label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants