Docker Community Forums

Share and learn in the Docker community.

Mounting folder to local disk and placing its files

(Dracomilesx) #1

Hello I am new to docker and for a project we are trying to create a docker container to make it easier for people to run it.

Our current issue is we have a Dockerfile which builds fine. But when we wan’t to run it with compose this is the part we use for our own container:

build: . # It will use DockerFile
restart: always

  • "3000:3000"
  • /volume4/Drive4/Lab/Docker/pogo/server/:/POGOserver/
    links :
  • db:db
  • web:web

As you see we try to mount /volume4/Drive4/Lab/Docker/pogo/server with the folder /POGOserver/ which we created in the Dockerfile. The linking works fine every file we put in the pogo/server folder gets placed into /POGOserver/ the logging files that get created by the container get placed as well properly on the local disk.

Now our issue is during the build process we use a git clone and a npm install to get the files we need and install the packages except those don’t get placed into the local disk folder /volume4/…

Doing a docker build on the Dockerfile and running it without compose and opening a connection to it shows the files fine in /POGOserver/.

The web container and mysql container that link their container folder to the local disk do properly place the files.

Now our question is how we can make it so that we can install the packages and git clone the files into /POGOserver/ and save them on our local disk while using docker-compose?

Hope i maded myself clear