美文网首页
2022-08-29 Podman for CentOS7

2022-08-29 Podman for CentOS7

作者: 阿群1986 | 来源:发表于2022-08-29 16:13 被阅读0次

    遇到的错误提示

    cannot clone: Invalid argument
    user namespaces are not enabled in /proc/sys/user/max_user_namespaces
    Error: could not get runtime: cannot re-exec process
    

    解决方法

    CentOS 7 requires running the following commands as root:

    echo 'user.max_user_namespaces=10000' > /etc/sysctl.d/42-rootless.conf
    sysctl --system
    

    问题1:

    user namespaces are not enabled in /proc/sys/user/max_user_namespaces

    解决办法

    # centos 7默认关闭了 user namespace,需要手动打开
    echo 10000 > /proc/sys/user/max_user_namespaces
    grubby --args="user_namespace.enable=1" --update-kernel="$(grubby --default-kernel)"
    echo "user.max_user_namespaces=10000" >> /etc/sysctl.conf
    
    # 普通用户
    echo $USER
    sudo usermod --add-subuids 10000-65535 $USER
    sudo usermod --add-subgids 10000-65535 $USER
    #
    echo USERNAME:10000:65535 >> sudo tee /etc/subuid
    echo USERNAME:10000:65535 >> sudo tee /etc/subgid
    

    镜像源顺序

    vi /etc/containers/registries.conf

    # 把docker.io 放到最前面
    unqualified-search-registries = ["docker.io", "registry.fedoraproject.org", "registry.access.redhat.com", "registry.centos.org"]
    

    作者:rekca
    链接:https://www.jianshu.com/p/7b1be93ef3d7
    来源:简书
    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

    相关文章

      网友评论

          本文标题:2022-08-29 Podman for CentOS7

          本文链接:https://www.haomeiwen.com/subject/qgxknrtx.html