Mount folders In dockerfile

I'm having the issue when I create my dockerfile I need to mount 3 different folders, where the container will share files with the host. How can I configure this in the dockerfile?
  • post-author-pic
    Travis T

    You can add the VOLUME instruction as an array.

    VOLUME ["/var/www", "/var/log/apache2", "/etc/apache2"]
    However, you will still need to specify the volume mapping when you execute a docker run or in your Docker Compose file.

  • post-author-pic
    Sean G

    Check out the storage and volumes section and the Image Creation, Management, and Registry section of the docker cert course it covers how to mount a shared directory and create a docker file. 

    If you've already done that and are having some problem, let us know what  you've got configured already and what error you're getting.

Looking For Team Training?

Learn More