diff --git a/main.go b/main.go index 8eed9139..46194ac7 100644 --- a/main.go +++ b/main.go @@ -67,6 +67,7 @@ var ( sessionDeleteTimeout time.Duration serviceStartupTimeout time.Duration limit int + containerNetwork string sessions = session.NewMap() confPath string logConfPath string @@ -99,6 +100,7 @@ func init() { flag.BoolVar(&version, "version", false, "Show version and exit") flag.Var(&mem, "mem", "Containers memory limit e.g. 128m or 1g") flag.Var(&cpu, "cpu", "Containers cpu limit as float e.g. 0.2 or 1.0") + flag.StringVar(&containerNetwork, "container-network", "default", "Network to be used for containers") flag.Parse() if version { @@ -133,6 +135,7 @@ func init() { InDocker: inDocker, CPU: int64(cpu), Memory: int64(mem), + Network: containerNetwork, StartupTimeout: serviceStartupTimeout, } if disableDocker { diff --git a/service/docker.go b/service/docker.go index 794cf076..eba70f33 100644 --- a/service/docker.go +++ b/service/docker.go @@ -67,6 +67,7 @@ func (d *Docker) StartWithCancel() (*StartedService, error) { AutoRemove: true, PortBindings: portBindings, LogConfig: *d.LogConfig, + NetworkMode: container.NetworkMode(d.Network), Tmpfs: d.Service.Tmpfs, ShmSize: 268435456, Privileged: true, @@ -95,7 +96,7 @@ func (d *Docker) StartWithCancel() (*StartedService, error) { _, ok := stat.NetworkSettings.Ports[selenium] if !ok { d.removeContainer(ctx, d.Client, container.ID) - return nil, fmt.Errorf("no bingings available for %v", selenium) + return nil, fmt.Errorf("no bindings available for %v", selenium) } seleniumHostPort, vncHostPort := "", "" if d.IP == "" { diff --git a/service/service.go b/service/service.go index 46b73ff2..1ece23dd 100644 --- a/service/service.go +++ b/service/service.go @@ -18,6 +18,7 @@ type Environment struct { InDocker bool CPU int64 Memory int64 + Network string StartupTimeout time.Duration }