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

Use bridge gateway as syslog host #526

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions internal/providers/docker/components/container/lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"os/user"
"path"
"runtime"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -89,11 +88,6 @@ func (c *Container) Initialize(ctx context.Context, input *core.InitializeInput)
}

func (c *Container) create(ctx context.Context, spec *Spec) error {
dockerInfo, err := c.Docker.Info(ctx)
if err != nil {
return fmt.Errorf("getting docker info: %w", err)
}

var healthCfg *container.HealthConfig
if spec.Healthcheck != nil {
healthCfg = &container.HealthConfig{
Expand Down Expand Up @@ -204,11 +198,10 @@ func (c *Container) create(ctx context.Context, spec *Spec) error {
// No logging configuration specified, so default to logging to exo's
// syslog service.
logCfg.Type = "syslog"
syslogHost := "localhost"
// TODO: Find an OS-agnostic way to figure out the "gateway-host" name as
// reachable from the dockerd process.
if runtime.GOOS == "darwin" || strings.Contains(dockerInfo.KernelVersion, "microsoft") {
syslogHost = "host.docker.internal"
dockerIsLocal := strings.HasPrefix(c.Docker.DaemonHost(), "unix://")
syslogHost := "host.docker.internal"
if dockerIsLocal {
syslogHost = "localhost"
}
logCfg.Config = map[string]string{
"syslog-address": fmt.Sprintf("udp://%s:%d", syslogHost, c.SyslogPort),
Expand Down Expand Up @@ -311,6 +304,7 @@ func (c *Container) create(ctx context.Context, spec *Spec) error {
Init: spec.Init.Ptr(),
}

var err error
if hostCfg.IpcMode, err = c.parseIPCMode(spec.IPC.Value); err != nil {
return err
}
Expand Down