-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add network_aliases for docker driver #1980
Conversation
0581413
to
6c78e68
Compare
EndpointsConfig: make(map[string]*docker.EndpointConfig), | ||
} | ||
|
||
if len(driverConfig.NetworkAliases) > 0 && hostConfig.NetworkMode != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the need to gate on && hostConfig.NetworkMode != ""
?
Can you update the driver docs: https://github.com/hashicorp/nomad/blob/master/website/source/docs/drivers/docker.html.md |
93ceb0f
to
693dbc2
Compare
@dadgar done, please review |
Is it possible/interesting to add the task name as a default network alias? |
} | ||
|
||
if len(driverConfig.NetworkAliases) > 0 { | ||
endpointNetworkName := hostConfig.NetworkMode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed? On Line 729 hostConfig.NetworkMode is set some default.
if hostConfig.NetworkMode == "" {
// docker default
d.logger.Printf("[DEBUG] driver.docker: networking mode not specified; defaulting to %s", defaultNetworkMode)
hostConfig.NetworkMode = defaultNetworkMode
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
if endpointNetworkName == "" { | ||
endpointNetworkName = "default" | ||
} | ||
networkingConfig.EndpointsConfig[endpointNetworkName] = &docker.EndpointConfig{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that set aliases on defaultNetworkMode, bridge, is not allowed.
693dbc2
to
49416eb
Compare
Network aliases only allowed for user defined networks, not for docker predefined networks, eg
will raise an error. If nomad adds default aliases for default networks |
@jorgemarey Is there any news for this pull request? |
Thanks! Great work! |
Great improvement. When it will be released? |
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
#1948 Add
config.network_aliases
key. PL doesn't have tests because fsouza/go-dockerclient doesn't provide query api for aliases.