Can I specify host directory to mount from Dockerfile

Dockerfiles are meant to be portable and shared. The host-dir volume is something 100% host dependent and will break on any other machine, which is a little bit off the Docker idea.

Because of this, it is only possible to use portable instructions within a Dockerfile. If you need a host-dir volume, you need to specify it at run-time.

A common usage of VOLUME from Dockerfile is to store configuration or website sources so that it can be updated later by another container.

Leave a Comment