Skip to content

feat(connection): support TLS docker hosts via DOCKER_CERT_PATH#258

Merged
jarlah merged 1 commit into
mainfrom
feat/202-tls-docker-host
Apr 22, 2026
Merged

feat(connection): support TLS docker hosts via DOCKER_CERT_PATH#258
jarlah merged 1 commit into
mainfrom
feat/202-tls-docker-host

Conversation

@jarlah
Copy link
Copy Markdown
Member

@jarlah jarlah commented Apr 22, 2026

Summary

  • Extend Testcontainers.DockerUrl.construct/1 to recognize https:// URLs (pass-through) and to promote tcp:// URLs to https:// when DOCKER_TLS_VERIFY is truthy (1/true), mirroring Docker CLI behavior.
  • When the resolved Docker host URL is https, Testcontainers.Connection.get_connection/1 now configures the hackney adapter with :ssl_options built from DOCKER_CERT_PATH (falling back to ~/.docker): ca.pem, cert.pem, and key.pem are loaded when present; missing files are skipped with a debug log. Verify mode is :verify_peer when DOCKER_TLS_VERIFY is set, otherwise :verify_none with a warning log.
  • Existing unix://, http://, and non-TLS tcp:// flows are unchanged.

Fixes #202

Test plan

  • mix compile — clean
  • mix credo --strict — no issues
  • mix dialyzer — no warnings
  • New test/connection/docker_url_test.exs covers URL construction across schemes and DOCKER_TLS_VERIFY values
  • New test/connection/tls_test.exs covers SSL-option assembly with a fixture cert dir and with missing files
  • Full mix test — 211 tests, 0 failures

Extend DockerUrl.construct/1 to handle https:// URLs and to promote
tcp:// URLs to https:// when DOCKER_TLS_VERIFY is truthy, mirroring the
Docker CLI. When the resolved URL is https, the Tesla/hackney adapter is
configured with :ssl_options loaded from DOCKER_CERT_PATH (falling back
to ~/.docker). Missing cert files are skipped with a debug log; verify
mode follows DOCKER_TLS_VERIFY.

Fixes #202
@jarlah jarlah merged commit e80811e into main Apr 22, 2026
8 checks passed
@jarlah jarlah deleted the feat/202-tls-docker-host branch April 22, 2026 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No instruction to work with TLS certificates

1 participant