diff options
author | Lucio Franco <luciofranco14@gmail.com> | 2019-12-05 22:42:44 -0500 |
---|---|---|
committer | Doug Tangren <d.tangren@gmail.com> | 2019-12-05 22:42:44 -0500 |
commit | 3cc4515d392e579f8f5293e051c7ddeda14f0498 (patch) | |
tree | 3a66e0a9b3eab8c858550b52e1fd943025b6d733 | |
parent | df9e408e4b39729ac22af28628a3ff2c69194d9a (diff) |
Replace host str to use https if encrypted (#193)
* Replace host str to use https if encrypted
* Add comment and fmt
-rw-r--r-- | src/lib.rs | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -885,6 +885,16 @@ fn get_docker_for_tcp(tcp_host_str: String) -> Docker { connector.set_ca_file(&Path::new(ca)).unwrap(); } + // If we are attempting to connec to the docker daemon via tcp + // we need to convert the scheme to `https` to let hyper connect. + // Otherwise, hyper will reject the connection since it does not + // recongnize `tcp` as a valid `http` scheme. + let tcp_host_str = if tcp_host_str.contains("tcp://") { + tcp_host_str.replace("tcp://", "https://") + } else { + tcp_host_str + }; + Docker { transport: Transport::EncryptedTcp { client: Client::builder() |