• Could not run process: container_linux.go:349: starting container process caused "process_linux.go:449:


    docker: Error response from daemon: OCI runtime create failed: rpc error: code = Internal desc = Could not run process: container_linux.go:349: starting container process caused "process_linux.go:449:

    container init caused "rootfs_linux.go:70: creating device nodes caused \"no such file or directory\""": unknown.

    func (c *linuxContainer) start(process *Process) error {
            parent, err := c.newParentProcess(process)
            if err != nil {
                    return newSystemErrorWithCause(err, "creating new parent process")
            }
            parent.forwardChildLogs()
            if err := parent.start(); err != nil {
                    // terminate the process to ensure that it properly is reaped.
                    if err := ignoreTerminateErrors(parent.terminate()); err != nil {
                            logrus.Warn(err)
                    }
                    return newSystemErrorWithCause(err, "starting container process")
            }
            // generate a timestamp indicating when the container was started
            c.created = time.Now().UTC()
            if process.Init {
                    c.state = &createdState{
                            c: c,
                    }
                    state, err := c.updateState(parent)
                    if err != nil {
                            return err
                    }
                    c.initProcessStartTime = state.InitProcessStartTime
    
                    if c.config.Hooks != nil {
                            s, err := c.currentOCIState()
                            if err != nil {
                                    return err
                            }
                            for i, hook := range c.config.Hooks.Poststart {
                                    if err := hook.Run(s); err != nil {
                                            if err := ignoreTerminateErrors(parent.terminate()); err != nil {
                                                    logrus.Warn(err)
                                            }
                                            return newSystemErrorWithCausef(err, "running poststart hook %d", i)
                                    }
                            }
                    }
            }
            return nil
    }
    // prepareRootfs sets up the devices, mount points, and filesystems for use
    // inside a new mount namespace. It doesn't set anything as ro. You must call
    // finalizeRootfs after this function to finish setting up the rootfs.
    func prepareRootfs(pipe io.ReadWriter, iConfig *initConfig) (err error) {
            config := iConfig.Config
            if err := prepareRoot(config); err != nil {
                    return newSystemErrorWithCause(err, "preparing rootfs")
            }
    
            hasCgroupns := config.Namespaces.Contains(configs.NEWCGROUP)
            setupDev := needsSetupDev(config)
            for _, m := range config.Mounts {
                    for _, precmd := range m.PremountCmds {
                            if err := mountCmd(precmd); err != nil {
                                    return newSystemErrorWithCause(err, "running premount command")
                            }
                    }
                    if err := mountToRootfs(m, config.Rootfs, config.MountLabel, hasCgroupns); err != nil {
                            return newSystemErrorWithCausef(err, "mounting %q to rootfs %q at %q", m.Source, config.Rootfs, m.Destination)
                    }
    
                    for _, postcmd := range m.PostmountCmds {
                            if err := mountCmd(postcmd); err != nil {
                                    return newSystemErrorWithCause(err, "running postmount command")
                            }
                    }
            }
    
            if setupDev {
                    if err := createDevices(config); err != nil {
                            return newSystemErrorWithCause(err, "creating device nodes")
                    }
    func createHooks(rspec *specs.Spec, config *configs.Config) {
            config.Hooks = &configs.Hooks{}
            if rspec.Hooks != nil {
    
                    for _, h := range rspec.Hooks.Prestart {
                            cmd := createCommandHook(h)
                            config.Hooks.Prestart = append(config.Hooks.Prestart, configs.NewCommandHook(cmd))
                    }
                    for _, h := range rspec.Hooks.Poststart {
                            cmd := createCommandHook(h)
                            config.Hooks.Poststart = append(config.Hooks.Poststart, configs.NewCommandHook(cmd))
                    }
                    for _, h := range rspec.Hooks.Poststop {
                            cmd := createCommandHook(h)
                            config.Hooks.Poststop = append(config.Hooks.Poststop, configs.NewCommandHook(cmd))
                    }
            }
    }
    docker: Error response from daemon: OCI runtime create failed: 
    rpc error: code = Internal desc = Could not run process: container_linux.go:349: 
    starting container process caused "process_linux.go:449: container init caused "no such file or directory"": unknown.
                    case procHooks:
                            // Setup cgroup before prestart hook, so that the prestart hook could apply cgroup permissions.
                            if err := p.manager.Set(p.config.Config); err != nil {
                                    return newSystemErrorWithCause(err, "setting cgroup config for procHooks process")
                            }
                            if p.intelRdtManager != nil {
                                    if err := p.intelRdtManager.Set(p.config.Config); err != nil {
                                            return newSystemErrorWithCause(err, "setting Intel RDT config for procHooks process")
                                    }
                            }
                            if p.config.Config.Hooks != nil {
                                    s, err := p.container.currentOCIState()
                                    if err != nil {
                                            return err
                                    }
                                    // initProcessStartTime hasn't been set yet.
                                    s.Pid = p.cmd.Process.Pid
                                    s.Status = "creating"
                                    for i, hook := range p.config.Config.Hooks.Prestart {
                                            if err := hook.Run(s); err != nil {
                                                    return newSystemErrorWithCausef(err, "running prestart hook %d", i)
                                            }
                                    }
                            }
                            // Sync with child.
                            if err := writeSync(p.messageSockPair.parent, procResume); err != nil {
                                    return newSystemErrorWithCause(err, "writing syncT 'resume'")
                            }
                            sentResume = true
                    default:
                            return newSystemError(fmt.Errorf("invalid JSON payload from child"))
                    }
    
                    return nil
            })
    
            if !sentRun {
                    return newSystemErrorWithCause(ierr, "container init")
            }
  • 相关阅读:
    网络流24题
    Preliminaries for Benelux Algorithm Programming Contest 2019
    2019 ICPC Asia Xuzhou Regional
    2019 ICPC Asia Nanjing Regional
    后缀自动机学习
    2018 ACM-ICPC 焦作区域赛 E Resistors in Parallel
    2019 ICPC 上海区域赛总结
    LA 3641 Leonardo的笔记本 & UVA 11077 排列统计
    UVA 10294 项链与手镯 (置换)
    CF 1288 E. Messenger Simulator
  • 原文地址:https://www.cnblogs.com/dream397/p/14073469.html
Copyright © 2020-2023  润新知