mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
TLS docker connection
This commit is contained in:
parent
bedde4a037
commit
d15dbfc11e
3 changed files with 45 additions and 1 deletions
12
README.md
12
README.md
|
|
@ -77,6 +77,18 @@ Memorising docker commands is hard. Memorising aliases is slightly less hard. Ke
|
|||
- Docker >= **1.13** (API >= **1.25**)
|
||||
- Docker-Compose >= **1.23.2** (optional)
|
||||
|
||||
## TLS Configuration
|
||||
|
||||
Lazydocker supports secure connections to Docker daemon using TLS. To enable TLS, you can configure it in your config.yml:
|
||||
|
||||
```yaml
|
||||
tls:
|
||||
enable: true
|
||||
caCertPath: "/path/to/ca.pem"
|
||||
certPath: "/path/to/cert.pem"
|
||||
keyPath: "/path/to/key.pem"
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
### Homebrew
|
||||
|
|
|
|||
|
|
@ -97,7 +97,22 @@ func NewDockerCommand(log *logrus.Entry, osCommand *OSCommand, tr *i18n.Translat
|
|||
dockerHost = dockerHostFromEnv
|
||||
}
|
||||
|
||||
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion(APIVersion), client.WithHost(dockerHost))
|
||||
opts := []client.Opt{
|
||||
client.FromEnv,
|
||||
client.WithVersion(APIVersion),
|
||||
client.WithHost(dockerHost),
|
||||
}
|
||||
|
||||
if config.UserConfig.TLS.Enable {
|
||||
tlsOpts := client.WithTLSClientConfig(
|
||||
config.UserConfig.TLS.CACertPath,
|
||||
config.UserConfig.TLS.CertPath,
|
||||
config.UserConfig.TLS.KeyPath,
|
||||
)
|
||||
opts = append(opts, tlsOpts)
|
||||
}
|
||||
|
||||
cli, err := client.NewClientWithOpts(opts...)
|
||||
if err != nil {
|
||||
ogLog.Fatal(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ type UserConfig struct {
|
|||
// hit esc or q when no confirmation panels are open
|
||||
ConfirmOnQuit bool `yaml:"confirmOnQuit,omitempty"`
|
||||
|
||||
// TLS configuration for connecting to Docker daemon
|
||||
TLS TLSConfig `yaml:"tls,omitempty"`
|
||||
|
||||
// Logs determines how we render/filter a container's logs
|
||||
Logs LogsConfig `yaml:"logs,omitempty"`
|
||||
|
||||
|
|
@ -346,6 +349,14 @@ type LogsConfig struct {
|
|||
Tail string `yaml:"tail,omitempty"`
|
||||
}
|
||||
|
||||
// TLSConfig holds TLS configuration for connecting to Docker daemon
|
||||
type TLSConfig struct {
|
||||
Enable bool `yaml:"enable,omitempty"`
|
||||
CACertPath string `yaml:"caCertPath,omitempty"`
|
||||
CertPath string `yaml:"certPath,omitempty"`
|
||||
KeyPath string `yaml:"keyPath,omitempty"`
|
||||
}
|
||||
|
||||
// GetDefaultConfig returns the application default configuration NOTE (to
|
||||
// contributors, not users): do not default a boolean to true, because false is
|
||||
// the boolean zero value and this will be ignored when parsing the user's
|
||||
|
|
@ -474,6 +485,12 @@ func GetDefaultConfig() UserConfig {
|
|||
Replacements: Replacements{
|
||||
ImageNamePrefixes: map[string]string{},
|
||||
},
|
||||
TLS: TLSConfig{
|
||||
Enable: false,
|
||||
CACertPath: "",
|
||||
CertPath: "",
|
||||
KeyPath: "",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue