OCI 运行时创建失败:container_linux.go:380: 启动容器进程导致:设置用户:无效参数:未知

发布于 2025-01-14 05:19:38 字数 2012 浏览 3 评论 0原文

我正在尝试访问 docker 容器内的主机(ubuntu)文件夹(在开发过程中从容器中读取和写入)。所以我正在尝试的是,获取主机文件夹所有者的用户 ID 和groupid 并在 docker 容器中创建相同的用户,但是当我尝试构建映像时,我不断收到此错误,但我使用的是无根 docker 容器。

这是我的 dockerfile,

FROM nvidia/cuda:11.1.1-cudnn8-runtime-ubuntu18.04

ARG NB_USER="jovyan"
ARG NB_UID="312349448"  #Userid for the host user
ARG NB_GID="1611487162" #Groupid for the host user
ENV HOME /home/${NB_USER}


ENV PYSPARK_PYTHON=python3
ENV PYSPARK_DRIVER_PYTHON=python3


RUN apt-get install -y --no-install-recommends ca-certificates && \
    rm -rf /var/lib/apt/lists/* \
    && update-ca-certificates 


RUN apt-get update && apt-get install -y \
    tar \
    wget \
    bash \
    rsync \
    gcc \
    curl \ 
    wget \
    htop \
    git \
    gcc \
    sudo \
    libfreetype6-dev \
    libhdf5-serial-dev \
    libpng-dev \
    libzmq3-dev \
    python3 \
    python3-dev \
    python3-pip

RUN apt-get update && \
    useradd -l -m -s /bin/zsh -N -u "${NB_UID}" "${NB_USER}" && \
    echo "${NB_USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers


USER ${NB_UID}
WORKDIR /home/jovyan
RUN sudo chown -R ${NB_UID}:${NB_GID} /home/jovyan

# Jupyter lab & other python packages
RUN pip3 install --upgrade pip

RUN pip3 install --no-cache-dir awscli \
    pyspark \
    notebook==5.* \
    numpy \
    pandas \
    jupyterlab \
    jupyter-dash \
    jupytext \
    nbresuse \
    ipywidgets 


# Kubeflow specific stuff
ENV NB_PREFIX /

# COPY run.sh /run.sh
# RUN sudo chmod +x /run.sh
# CMD ["/run.sh"]
CMD ["jupyter", "lab","--notebook-dir=/home/jovyan","--ip=0.0.0.0","--allow-root","--no-browser","--port=8888","--ServerApp.token=''","--ServerApp.password=''"]

这是我收到的错误,我可以粗略地说它与用户相关,但不知道为什么会发生这种情况以及该怎么做,

Step 19/23 : RUN sudo chown -R ${NB_UID}:${NB_GID} /home/jovyan
 ---> Running in 10f8a668bcc1
OCI runtime create failed: container_linux.go:380: starting container process caused: setup user: invalid argument: unknown

I am trying to access host machine (ubuntu) folder within docker container (both to read and write from the container during my development). So what I am trying is, getting the host machine folder owner's userid & groupid and creating the same user within the docker container, but I keep getting this error when I try to build the image, I am using rootless docker container though.

Here is my dockerfile,

FROM nvidia/cuda:11.1.1-cudnn8-runtime-ubuntu18.04

ARG NB_USER="jovyan"
ARG NB_UID="312349448"  #Userid for the host user
ARG NB_GID="1611487162" #Groupid for the host user
ENV HOME /home/${NB_USER}


ENV PYSPARK_PYTHON=python3
ENV PYSPARK_DRIVER_PYTHON=python3


RUN apt-get install -y --no-install-recommends ca-certificates && \
    rm -rf /var/lib/apt/lists/* \
    && update-ca-certificates 


RUN apt-get update && apt-get install -y \
    tar \
    wget \
    bash \
    rsync \
    gcc \
    curl \ 
    wget \
    htop \
    git \
    gcc \
    sudo \
    libfreetype6-dev \
    libhdf5-serial-dev \
    libpng-dev \
    libzmq3-dev \
    python3 \
    python3-dev \
    python3-pip

RUN apt-get update && \
    useradd -l -m -s /bin/zsh -N -u "${NB_UID}" "${NB_USER}" && \
    echo "${NB_USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers


USER ${NB_UID}
WORKDIR /home/jovyan
RUN sudo chown -R ${NB_UID}:${NB_GID} /home/jovyan

# Jupyter lab & other python packages
RUN pip3 install --upgrade pip

RUN pip3 install --no-cache-dir awscli \
    pyspark \
    notebook==5.* \
    numpy \
    pandas \
    jupyterlab \
    jupyter-dash \
    jupytext \
    nbresuse \
    ipywidgets 


# Kubeflow specific stuff
ENV NB_PREFIX /

# COPY run.sh /run.sh
# RUN sudo chmod +x /run.sh
# CMD ["/run.sh"]
CMD ["jupyter", "lab","--notebook-dir=/home/jovyan","--ip=0.0.0.0","--allow-root","--no-browser","--port=8888","--ServerApp.token=''","--ServerApp.password=''"]

This is the error I am getting, I can roughly say its related to user, but dont know why this is happening and what to do,

Step 19/23 : RUN sudo chown -R ${NB_UID}:${NB_GID} /home/jovyan
 ---> Running in 10f8a668bcc1
OCI runtime create failed: container_linux.go:380: starting container process caused: setup user: invalid argument: unknown

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文