1
0
mirror of https://github.com/rancher/os.git synced 2025-07-01 09:11:48 +00:00

Create but do not start udev on system-docker

Eventually this container will be replaced with udev hotplug
This commit is contained in:
Darren Shepherd 2015-03-19 14:58:40 -07:00
parent 130caa1abd
commit e34c3a5e2d
2 changed files with 20 additions and 6 deletions

View File

@ -57,7 +57,7 @@ func getHash(containerCfg *config.ContainerConfig) (string, error) {
}
func StartAndWait(dockerHost string, containerCfg *config.ContainerConfig) error {
container := NewContainer(dockerHost, containerCfg).start(true)
container := NewContainer(dockerHost, containerCfg).start(false, true)
return container.Err
}
@ -187,12 +187,16 @@ func (c *Container) Parse() *Container {
return c
}
func (c *Container) Create() *Container {
return c.start(true, false)
}
func (c *Container) Start() *Container {
return c.start(false)
return c.start(false, false)
}
func (c *Container) StartAndWait() *Container {
return c.start(true)
return c.start(false, true)
}
func (c *Container) Stage() *Container {
@ -356,7 +360,7 @@ func appendVolumesFrom(client *dockerClient.Client, containerCfg *config.Contain
return nil
}
func (c *Container) start(wait bool) *Container {
func (c *Container) start(create_only, wait bool) *Container {
c.Lookup()
c.Stage()
@ -416,6 +420,10 @@ func (c *Container) start(wait bool) *Container {
hostConfig = opts.HostConfig
}
if create_only {
return c
}
if !c.Container.State.Running {
if !created {
err = c.renameOld(client, opts)

View File

@ -119,8 +119,14 @@ func runContainersFrom(startFrom string, cfg *config.Config, containerConfigs []
}
if foundStart || startFrom == "" {
log.Infof("Running [%d/%d] %s", i+1, len(containerConfigs), containerConfig.Id)
container.StartAndWait()
if containerConfig.CreateOnly {
log.Infof("Creating [%d/%d] %s", i+1, len(containerConfigs), containerConfig.Id)
container.Create()
} else {
log.Infof("Running [%d/%d] %s", i+1, len(containerConfigs), containerConfig.Id)
container.StartAndWait()
}
if container.Err != nil {
log.Errorf("Failed to run %v: %v", containerConfig.Id, container.Err)