Cannot Execute RUN Mkdir In A Dockerfile


Answer :

The problem is that /var/www doesn't exist either, and mkdir isn't recursive by default -- it expects the immediate parent directory to exist.

Use:

mkdir -p /var/www/app 

...or install a package that creates a /var/www prior to reaching this point in your Dockerfile.


When creating subdirectories hanging off from a non-existing parent directory(s) you must pass the -p flag to mkdir ... Please update your Dockerfile with

RUN mkdir -p ...  

I tested this and it's correct.


You can also simply use

WORKDIR /var/www/app 

It will automatically create the folders if they don't exist.

Then switch back to the directory you need to be in.


Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?