Dockerfile permission denied error (Streamlit / OpenShift)

I used this template Dockerfile from Deploy Streamlit using Kubernetes - Streamlit Docs to create a container. The build runs through and is passed, but the container/pod shows an error concerning

Error: container create failed: time=“2023-11-07T23:40:52Z” level=error msg=“runc create failed: unable to start container process: exec: “./”: permission denied”

Whats the problem here?

Please respect to the very small changes in the Dockerfile, because I cannot use git clone there. But this is not the question - the question it why this “template” offered from streamlit does not work.

FROM python:3.8-slim

RUN groupadd --gid 1000 appuser \
    && useradd --uid 1000 --gid 1000 -ms /bin/bash appuser

RUN pip3 install --no-cache-dir --upgrade \
    pip \

RUN apt-get update && apt-get install -y \
    build-essential \
    software-properties-common \

USER appuser
WORKDIR /home/appuser

RUN git clone app

#THEREFORE ADDED (hope this is similar to the repo clone with ./app/?)
COPY ./app/
COPY requirements.txt ./app/

ENV VIRTUAL_ENV=/home/appuser/venv
RUN virtualenv ${VIRTUAL_ENV}
RUN . ${VIRTUAL_ENV}/bin/activate && pip install -r app/requirements.txt


COPY /home/appuser

The file also from streamlit docs is untouched (changed only the name of file to


stopRunningProcess() {
    # Based on
    if test ! "${APP_PID}" = '' && ps -p ${APP_PID} > /dev/null ; then
       > /proc/1/fd/1 echo "Stopping ${COMMAND_PATH} which is running with process ID ${APP_PID}"

       kill -TERM ${APP_PID}
       > /proc/1/fd/1 echo "Waiting for ${COMMAND_PATH} to process SIGTERM signal"

        wait ${APP_PID}
        > /proc/1/fd/1 echo "All processes have stopped running"
        > /proc/1/fd/1 echo "${COMMAND_PATH} was not started when the signal was sent or it has already been stopped"

trap stopRunningProcess EXIT TERM

source ${VIRTUAL_ENV}/bin/activate

streamlit run ${HOME}/app/ &

wait ${APP_ID}#!/bin/bash

hi @teq508
The “permission denied” error you are encountering is likely due to the fact that the script does not have the necessary execute permissions. You can fix this by adding the execute permission to the script before running it.

Modify your Dockerfile to include the following lines after copying the script:

COPY /home/appuser
RUN chmod +x /home/appuser/

After making this change, rebuild your Docker image and try running it again. This should resolve the “permission denied” issue.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.