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

new docker version change ip on container restart #12

Closed
wants to merge 1 commit 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
6 changes: 3 additions & 3 deletions src/containerbuddy/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ func loadConfig() *Config {
backend.onChangeArgs = strings.Split(backend.OnChangeExec, " ")
}

hostname, _ := os.Hostname()
for _, service := range config.Services {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hostname defaults to the Docker container ID, which is important in being able to interact with the container elsewhere. Removing it here breaks other uses.

service.Id = fmt.Sprintf("%s-%s", service.Name, hostname)
hostIP := getIp(service.IsPublic)
service.Id = fmt.Sprintf("%s-%s", service.Name, hostIP)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the format of the service.Id, replacing the hostname with the hostIP, which breaks expectations elsewhere that this is used.

service.discoveryService = discovery
service.healthArgs = strings.Split(service.HealthCheckExec, " ")
service.ipAddress = getIp(service.IsPublic)
service.ipAddress = hostIP
}

return config
Expand Down