Skip to content

Commit

Permalink
Merge pull request #180 from srl-wim/pull-timeout
Browse files Browse the repository at this point in the history
pull image timeout
  • Loading branch information
karimra committed Nov 28, 2020
2 parents 5c8c7d4 + 935526c commit e8b5dd3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions clab/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ func (c *cLab) DeleteBridge(ctx context.Context) (err error) {
func (c *cLab) CreateContainer(ctx context.Context, node *Node) (err error) {
log.Infof("Create container: %s", node.ShortName)

err = c.PullImageIfRequired(ctx, node.Image)
if err != nil {
return err
}

nctx, cancel := context.WithTimeout(ctx, c.timeout)
defer cancel()
labels := map[string]string{
Expand All @@ -162,11 +167,6 @@ func (c *cLab) CreateContainer(ctx context.Context, node *Node) (err error) {
labels["group"] = node.Group
}

err = c.PullImageIfRequired(nctx, node.Image)
if err != nil {
return err
}

cont, err := c.DockerClient.ContainerCreate(nctx,
&container.Config{
Image: node.Image,
Expand Down

0 comments on commit e8b5dd3

Please sign in to comment.