fixuid icon indicating copy to clipboard operation
fixuid copied to clipboard

How to run fixuid without overriding base image entrypoint?

Open Luc45 opened this issue 1 year ago • 0 comments

I'm trying to a extend this docker image that has a ENTRYPOINT and CMD:

USER 1000

ENTRYPOINT ["/dockerstartup/vnc_startup.sh"]
CMD ["--wait"]

I have tried a few different ways of overriding it:

First, no fixuid entrypoint, but then fixuid doesn't do anything.

# Use a debian-based VNC Server image as base
FROM consol/debian-xfce-vnc

# Switch to root user to install additional software
USER 0

ARG DEBIAN_FRONTEND=noninteractive

# Install required packages
RUN apt-get update && \
    apt-get install -y curl sudo

# Create the user "vncuser" with ID 1000
RUN useradd -u 1000 -m -s /bin/bash vncuser

# Install fixuid
RUN curl -SsL https://github.com/boxboat/fixuid/releases/download/v0.5/fixuid-0.5-linux-amd64.tar.gz | tar -C /usr/local/bin -xzf - && \
    chown root:root /usr/local/bin/fixuid && \
    chmod 4755 /usr/local/bin/fixuid && \
    mkdir -p /etc/fixuid && \
    printf "user: vncuser\ngroup: vncuser\npath: /home/vncuser\n" > /etc/fixuid/config.yml

# Update and install Node.js
RUN curl -sL https://deb.nodesource.com/setup_lts.x | bash - && \
    apt-get install -y nodejs
    
# Switch to the vncuser
USER 1000

# Install Playwright
RUN npm init -y && \
    npm install playwright

I tried overriding the entrypoint by running fixuid as root, and the upstream entrypoint as the user 1000, but it didn't work:

# Switch back to root
USER 0

RUN echo "vncuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

ENTRYPOINT ["sh", "-c", "fixuid && sudo -u vncuser /dockerstartup/vnc_startup.sh --wait"]
fixuid: fixuid should only ever be used on development systems. DO NOT USE IN PRODUCTION
fixuid: runtime UID '1000' already matches container user 'vncuser' UID
fixuid: runtime GID '1000' already matches container group 'vncuser' GID
/dockerstartup/vnc_startup.sh: line 60: /chrome-init.sh: No such file or directory

And I tried a lot of other small things as well. What would be the correct way of handling this?

Luc45 avatar Mar 18 '24 16:03 Luc45