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

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable