Share network namespace of containers with lxc
| ... | ... |
@@ -86,10 +86,17 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba |
| 86 | 86 |
"lxc-start", |
| 87 | 87 |
"-n", c.ID, |
| 88 | 88 |
"-f", configPath, |
| 89 |
- "--", |
|
| 90 |
- c.InitPath, |
|
| 89 |
+ } |
|
| 90 |
+ if c.Network.ContainerID != "" {
|
|
| 91 |
+ params = append(params, |
|
| 92 |
+ "--share-net", c.Network.ContainerID, |
|
| 93 |
+ ) |
|
| 91 | 94 |
} |
| 92 | 95 |
|
| 96 |
+ params = append(params, |
|
| 97 |
+ "--", |
|
| 98 |
+ c.InitPath, |
|
| 99 |
+ ) |
|
| 93 | 100 |
if c.Network.Interface != nil {
|
| 94 | 101 |
params = append(params, |
| 95 | 102 |
"-g", c.Network.Interface.Gateway, |