Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #172 from vania-pooh/master
Browse files Browse the repository at this point in the history
Added ability to specify custom network for containers (fixes #87)
  • Loading branch information
aandryashin authored Jul 28, 2017
2 parents 5a75c5d + f73fbea commit f7556d4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ var (
sessionDeleteTimeout time.Duration
serviceStartupTimeout time.Duration
limit int
containerNetwork string
sessions = session.NewMap()
confPath string
logConfPath string
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -133,6 +135,7 @@ func init() {
InDocker: inDocker,
CPU: int64(cpu),
Memory: int64(mem),
Network: containerNetwork,
StartupTimeout: serviceStartupTimeout,
}
if disableDocker {
Expand Down
3 changes: 2 additions & 1 deletion service/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 == "" {
Expand Down
1 change: 1 addition & 0 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Environment struct {
InDocker bool
CPU int64
Memory int64
Network string
StartupTimeout time.Duration
}

Expand Down

0 comments on commit f7556d4

Please sign in to comment.