I have a docker container with a volume /foo defined in the docker-compose.yml. The Dockerfile then does:
RUN useradd -d /home/newuser -m -s /bin/bash newuser && \
usermod newuser -g www-data
RUN chown -R newuser:www-data /foo
When the container is setup I can see it run the two commands with no errors, but the folder /foo is unchanged. When I run a shell on the container I can see the user is created. I can run chown on other directories and files fine. I'm not calling VOLUME anywhere in my Dockerfile for reference.