mirror of
https://github.com/rancher/os.git
synced 2025-08-31 14:23:11 +00:00
Merge pull request #312 from imikushin/fix-container-npe
prevent `nil` from being put back to `c.Container`
This commit is contained in:
@@ -529,7 +529,6 @@ func (c *Container) start(createOnly, wait bool) *Container {
|
||||
return c.returnErr(err)
|
||||
}
|
||||
|
||||
container := c.Container
|
||||
created := false
|
||||
|
||||
opts, err := c.getCreateOpts(client)
|
||||
@@ -563,15 +562,13 @@ func (c *Container) start(createOnly, wait bool) *Container {
|
||||
return c.returnErr(err)
|
||||
}
|
||||
|
||||
container, err = client.CreateContainer(*opts)
|
||||
c.Container, err = client.CreateContainer(*opts)
|
||||
created = true
|
||||
if err != nil {
|
||||
return c.returnErr(err)
|
||||
}
|
||||
}
|
||||
|
||||
c.Container = container
|
||||
|
||||
hostConfig := c.Container.HostConfig
|
||||
if created {
|
||||
hostConfig = opts.HostConfig
|
||||
|
Reference in New Issue
Block a user