Skip to content

Commit

Permalink
naming updates
Browse files Browse the repository at this point in the history
  • Loading branch information
henderiw committed Sep 1, 2020
1 parent 641c10e commit 79b351b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Binary file modified bin/containerlab
Binary file not shown.
13 changes: 9 additions & 4 deletions src/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,20 @@ func (c *cLab) createContainer(ctx context.Context, name string, node *Node) (er
Sysctls: node.Sysctls,
Privileged: true,
NetworkMode: container.NetworkMode(c.Conf.DockerInfo.Bridge),
}, nil, "lab"+"-"+c.Conf.Prefix+"-"+name)
}, nil, node.LongName)
if err != nil {
return err
}
log.Debug(fmt.Sprintf("Container create response: %v", c))

node.Cid = cont.ID

err = c.startContainer(ctx, "lab"+"-"+c.Conf.Prefix+"-"+name, node)
err = c.startContainer(ctx, node.LongName, node)
if err != nil {
return err
}

return c.inspectContainer(ctx, "lab"+"-"+c.Conf.Prefix+"-"+name, node)
return c.inspectContainer(ctx, node.LongName, node)
}

func (c *cLab) startContainer(ctx context.Context, name string, node *Node) (err error) {
Expand Down Expand Up @@ -203,10 +203,15 @@ func (c *cLab) deleteContainer(ctx context.Context, name string, node *Node) (er

for _, container := range containers {
for _, n := range container.Names {
if strings.Contains(n, "lab"+"-"+c.Conf.Prefix+"-"+name) {
if strings.Contains(n, node.LongName) {
cid = container.ID
break
}

//if strings.Contains(n, "lab"+"-"+c.Conf.Prefix+"-"+name) {
// cid = container.ID
// break
//}
}
}

Expand Down

0 comments on commit 79b351b

Please sign in to comment.