Skip to content

Add TLS certificate support for Docker contexts #3719

@Itx-Psycho0

Description

@Itx-Psycho0

Problem
PR #3684 added Docker context detection but only extracts the host URL. Docker contexts can also store TLS certificates for secure remote connections, which are currently ignored.

When a context is configured with TLS:

docker context create remote
--docker "host=tcp://remote.example.com:2376"
The Docker CLI works fine, but func fails to connect because it doesn't load the TLS certificates from the context.

Proposed Solution
Extend getDockerContextHost() to also read TLS configuration from the context's meta.json and tls/ directory:

~/.docker/contexts/meta//
├── meta.json
└── tls/
├── ca.pem
├── cert.pem
└── key.pem
Then configure the Docker client with these certificates when connecting to remote daemons (tcp://, ssh://).

Benefits
Remote Docker setups work automatically
Consistent with Docker CLI behavior
No manual environment variables needed
Proper TLS support for secure connections
Related
Issue #2226
PR #3684

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions