environment(docker): fix outgoing ip not changing
Fixes an issue where when a server has it's primary allocation changed, the outgoing ip is not updated on the Docker network. The only downside of this change is old networks are not cleaned up. Closes https://github.com/pterodactyl/panel/issues/4547
This commit is contained in:
parent
da94f750ad
commit
1457470fff
|
@ -196,7 +196,7 @@ func (e *Environment) Create() error {
|
||||||
networkMode := container.NetworkMode(cfg.Docker.Network.Mode)
|
networkMode := container.NetworkMode(cfg.Docker.Network.Mode)
|
||||||
if a.ForceOutgoingIP {
|
if a.ForceOutgoingIP {
|
||||||
e.log().Debug("environment/docker: forcing outgoing IP address")
|
e.log().Debug("environment/docker: forcing outgoing IP address")
|
||||||
networkName := strings.ReplaceAll(e.Id, "-", "")
|
networkName := "ip-" + strings.ReplaceAll(strings.ReplaceAll(a.DefaultMapping.Ip, ".", "-"), ":", "-")
|
||||||
networkMode = container.NetworkMode(networkName)
|
networkMode = container.NetworkMode(networkName)
|
||||||
|
|
||||||
if _, err := e.client.NetworkInspect(ctx, networkName, types.NetworkInspectOptions{}); err != nil {
|
if _, err := e.client.NetworkInspect(ctx, networkName, types.NetworkInspectOptions{}); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user