Merge 86842da1b8 into d739948989
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/mount"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/client"
|
||||
|
||||
"github.com/pterodactyl/wings/config"
|
||||
@@ -457,7 +458,25 @@ func (ip *InstallationProcess) Execute() (string, error) {
|
||||
}
|
||||
}()
|
||||
|
||||
r, err := ip.client.ContainerCreate(ctx, conf, hostConf, nil, nil, ip.Server.ID()+"_installer")
|
||||
var netConf *network.NetworkingConfig = nil //In case when no networking config is needed set nil
|
||||
var serverNetConfig = config.Get().Docker.Network
|
||||
if "macvlan" == serverNetConfig.Driver { //Generate networking config for macvlan driver
|
||||
var defaultMapping = ip.Server.Config().Allocations.DefaultMapping
|
||||
ip.Server.Log().Debug("Set macvlan " + serverNetConfig.Name + " IP to " + defaultMapping.Ip)
|
||||
netConf = &network.NetworkingConfig{
|
||||
EndpointsConfig: map[string]*network.EndpointSettings{
|
||||
serverNetConfig.Name: { //Get network name from wings config
|
||||
IPAMConfig: &network.EndpointIPAMConfig{
|
||||
IPv4Address: defaultMapping.Ip,
|
||||
},
|
||||
IPAddress: defaultMapping.Ip, //Use default mapping ip address (wings support only one network per server)
|
||||
Gateway: serverNetConfig.Interfaces.V4.Gateway,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
// Pass the networkings configuration or nil if none required
|
||||
r, err := ip.client.ContainerCreate(ctx, conf, hostConf, netConf, nil, ip.Server.ID()+"_installer")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user