Skip to content

[Bug]: Can't create non-root user using vllm/vllm-openai:v0.8.1 as a base image #15359

Closed
@Searcherr

Description

@Searcherr

Your current environment

U used to create a non-root user Docker image for vLLM and the following version was working fine up to v0.7.3:

FROM vllm/vllm-openai:v0.7.3

ENV PYTHONUNBUFFERED=1
ENV HF_HUB_CACHE=/api/models
ENV HF_HOME=/api/models

RUN mkdir -p /api/models/

# RUN chmod +x /api/entrypoint.sh
RUN chmod 777 -R /api \
  && umask 000

EXPOSE 8000

# Set user and group
ARG user=appuser
ARG group=appuser
ARG uid=1000
ARG gid=1000
RUN groupadd -g ${gid} ${group}
RUN useradd -u ${uid} -g ${group} -s /bin/sh -m ${user}
    
RUN chown ${user}:${group} /api

# Switch to user
USER ${uid}:${gid}

Today was trying to make the same with v0.8.1 and got permissions errors like this:
bash: /opt/venv/bin/vllm: /opt/venv/bin/python3: bad interpreter: Permission denied

To my understanding, in addition, /opt/venv/bin/python3 is actually a symbolic link pointing to /root/.local/share/uv/python/cpython-3.12.9-linux-x86_64-gnu/bin/python3.12

And even Dockefile modification that eventually has the following content does not work:

FROM vllm/vllm-openai:v0.8.1

ENV PYTHONUNBUFFERED=1
ENV HF_HUB_CACHE=/api/models
ENV HF_HOME=/api/models

RUN mkdir -p /api/models/

# Set user and group
ARG user=appuser
ARG group=appuser
ARG uid=1000
ARG gid=1000

# Create non-root user and group
RUN groupadd -g ${gid} ${group} \
    && useradd -u ${uid} -g ${group} -s /bin/sh -m ${user}

# Adjust permissions for Python environment and model directories
RUN chmod -R 777 /root/.local/share/uv/python/
RUN chown -R ${user}:${group} /api/models

# Ensure vllm workspace and virtual environment have correct permissions
ENV VIRTUAL_ENV="/opt/venv"
RUN chown -R ${user}:${group} /vllm-workspace \
    && chown -R ${user}:${group} ${VIRTUAL_ENV}

# Explicitly fix interpreter permissions
USER root
RUN chmod -R 755 ${VIRTUAL_ENV} \
    && chmod +x ${VIRTUAL_ENV}/bin/python3 \
    && chmod +x ${VIRTUAL_ENV}/bin/vllm \
    && chown -R ${user}:${group} ${VIRTUAL_ENV} \
    && chmod -R a+rX /root/.local/share/uv/python

# Restore non-root user context
USER ${uid}:${gid}

# Ensure PATH is correctly set
ENV PATH="${VIRTUAL_ENV}/bin:/home/${user}/.local/bin:${PATH}"

RUN chmod -R 777 /api && umask 000

EXPOSE 8000
WORKDIR /vllm-workspace

I would very appreciate if anyone shares his solution for this task or any advice in troubleshooting,

🐛 Describe the bug

bash: /opt/venv/bin/vllm: /opt/venv/bin/python3: bad interpreter: Permission denied

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions