• 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")
            }
  • 相关阅读:
    Shell脚本中cd命令使用
    OpenStack 的Nova组件详解
    Linux 查看网络连接状态
    Linux 怎么查看服务的启动进程所占用的目录
    邮政短信 运营商常见错误
    Linux 怎么把自己写的脚本添加到服务里面,即可以使用service命令来调用
    Linux 命令行生成随机密码的十种方法
    Linux rpm安装问题解决
    Codeforces 1082G(最大权闭合子图)
    Codeforces 1105D (BFS)
  • 原文地址:https://www.cnblogs.com/dream397/p/14073469.html
Copyright © 2020-2023  润新知