zoukankan      html  css  js  c++  java
  • 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")
            }
  • 相关阅读:
    Centos下Oracle11gR2安装教程与自动化配置脚本
    你知道CPU结构也会影响Redis性能吗?
    谈谈InnoDB中的B+树索引
    理论:第十一章:大厂程序员如何使用GitHub快速开发学习
    理论:第十四章:生产环境服务器变慢如何诊断,性能评估
    理论:第十三章:堆溢出,栈溢出的出现场景以及解决方案
    理论:第十二章:Dubbo的运行原理,支持什么协议,与SpringCould相比它为什么效率要高一些,Zookeeper底层原理
    理论:第十章:公平锁,非公平锁,可重入锁,递归锁,自旋锁,读写锁,悲观锁,乐观锁,行锁,表锁,死锁,分布式锁,线程同步锁分别是什么?
    理论:第九章:JVM内存模型,算法,垃圾回收器,调优,四大引用,常见的JVM错误,类加载机制(双亲委派),创建一个对象,这个对象在内存中是怎么分配的?
    理论:第八章:线程是什么,有几种实现方式,它们之间的区别是什么,线程池实现原理,JUC并发包,ThreadLocal与Lock和Synchronize区别
  • 原文地址:https://www.cnblogs.com/dream397/p/14073469.html
Copyright © 2011-2022 走看看