Home > other >  Creating an empty directory to docker container
Creating an empty directory to docker container

Time:10-15

How do I create an empty folder inside a docker container using a Dockerfile?

I guess I could just copy an empty folder from source as an empty "backup" directory to the container like:

COPY empty_dir backup

... but what I would like to do, is just to create the folder without referring to anything existing.
A script running in the container would need to access this folder later on to copy some backup-files into it.
Is there a command like MKDIR to be used in the Dockerfile?

Simple question, but couldn't find answer to it (easily at least).

CodePudding user response:

You could create it with :

RUN mkdir -p /path/to/my/myemptydir

-p allows to make intermediate directories.

  • Related