I guess you are switching to user “admin” which doesn’t have the ownership to change permissions on /app directory. Change the ownership using “root” user. Below Dockerfile worked for me –
FROM python:2.7
RUN pip install Flask==0.11.1
RUN useradd -ms /bin/bash admin
COPY app /app
WORKDIR /app
RUN chown -R admin:admin /app
RUN chmod 755 /app
USER admin
CMD ["python", "app.py"]
PS – Try to get rid of “777” permission. I momentarily tried to do it in above Dockerfile.