Docker Community Forums

Share and learn in the Docker community.

Mounting folders outside the user's folder on Windows


#1

I may just be failing to searching these forums, as I feel like this is something that would have been asked and answered, but how can I mount folders outside the User directory on Docker Toolbox on WIndows 10 Home? I’ve shared the folder onto the VM, but can’t seem to actually get it to mount into a container (using docker compose). I’ve tried looking online but everything seems to be 2+ years ago and out of date.

I’ve followed the steps here: https://docs.docker.com/toolbox/toolbox_install_windows/#optional-add-shared-directories but when I use docker exec -it dockernginxphpexample_web_1 /bin/ash to try checking out the folder in the container, the directory is empty.

Can I do this? It’s really frustrating that it looks like I’d have to do work in one folder and then move it to another to actually put into my containers.


(Tekki) #2

Did you mount a folder into the container? See https://docs.docker.com/engine/reference/run/#volume-shared-filesystems. And if it still doesn’t work check your firewall, it may block the Docker network.


#3

If it helps, this is my docker compose:

version: '3'

services:

  web:
    build:
      context: .
      dockerfile: docker/nginx/Dockerfile
    ports:
      - 8080:80
    volumes:
      - ./public:/code
    links:
      - php

  php:
    build:
      context: .
      dockerfile: docker/php/Dockerfile
    volumes:
      - ./public:/code