Docker Community Forums

Share and learn in the Docker community.

Problem with directory mounting


(Enota) #1

I’m trying to mount an existing directory for my container, suppose the directory is D:\data on Window OS.
For that, I shared the directory in VirtualBox as /data. Then I created a folder on that virtual machine and mounted my shared folder there:
sudo mkdir /data_share
sudo mount -t vboxsf /data /data_share
When I SSH to the docker machine I can see that the folder /data_share exists there.
I have the following settings regarding the directory being mounted in my docker-compose.yml file:
services:
s1:
volumes:
- "data:/data"
volumes:
data:
external:
name: /data_share

Bun when I’m trying to build and run the container with “docker-compose -up -d” I get the following error:
Volume /data_share declared as external, but could not be found.
What am I doing wrong?