Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

3.1K
Vistas
How to mount network Volume in Docker for Windows (Windows 10)

We're working to create a standard "data science" image in Docker in order to help our team maintain a consistent environment. In order for this to be useful for us, we need the containers to have read/write access to our company's network. How can I mount a network drive to a docker container?

Here's what I've tried using the rocker/rstudio image from Docker Hub:

This works:

docker run -d -p 8787:8787 -v //c/users/{insert user}:/home/rstudio/foobar rocker/rstudio

This does not work (where P is the mapped location of the network drive): docker run -d -p 8787:8787 -v //p:/home/rstudio/foobar rocker/rstudio

This also does not work: docker run -d -p 8787:8787 -v //10.1.11.###/projects:/home/rstudio/foobar rocker/rstudio

Any suggestions?

I'm relatively new to Docker, so please let me know if I'm not being totally clear.

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

I know this is relatively old - but for the sake of others - here is what usually works for me. for use - we use a windows file-server so we use cifs-utils in order to map the drive. I assume that below instructions can be applied to nfs or anything else as well.

first - need to run the container in privileged mode so that you can mount remote folders inside of the container (--dns flag might not be required)
docker run --dns <company dns ip> -p 8000:80 --privileged -it <container name and tag>

now, (assuming centos with cifs and being root in the container) - hop into the container and run:

install cifs-utils if not installed yet
yum -y install cifs-utils

create the local dir to be mapped
mkdir /mnt/my-mounted-folder

prepare a file with username and credentials
echo "username=<username-with-access-to-shared-drive>" > ~/.smbcredentials
echo "password=<password>" > ~/.smbcredentials

map the remote folder
mount <remote-shared-folder> <my-local-mounted-folder> -t cifs -o iocharset=utf8,credentials=/root/.smbcredentials,file_mode=0777,dir_mode=0777,uid=1000,gid=1000,cache=strict

now you should have access

hope this helps..

over 4 years ago · Santiago Trujillo Denunciar

0

I have been searching the solution the last days and I just get one working.

I am running docker container on an ubuntu virtual machine and I am mapping a folder on other host on the same network which is running windows 10, but I am almost sure that the operative system where the container is running is not a problem because the mapping is from the container itself so I think this solution should work in any SO.

Let's code.

First you should create the volume

docker volume create 
--driver local 
--opt type=cifs 
--opt device=//<network-device-ip-folder>
--opt o=user=<your-user>,password=<your-pw>
<volume-name>

And then you have to run a container from an image

 docker run 
 --name <desired-container-name> 
 -v <volume-name>:/<path-inside-container>
 <image-name>

After this a container is running with the volume assignated to it, and is mapped to . You create some file in any of this folders and it will be replicated automatically to the other.

In case someone wants to get this running from docker-compose I leave this here

services:
  <image-name>:
    build: 
      context: .
    container_name: <desired-container-name> 
    volumes:
       -  <volume-name>:/<path-inside-container>
    ...

volumes:
  <volume-name>:
    driver: local
    driver_opts: 
      type: cifs 
      device: //<network-device-ip-folder>
      o: "user=<your-user>,password=<your-pw>"

Hope I can help

over 4 years ago · Santiago Trujillo Denunciar

0

I will write my decision. I have a Synology NAS. The shared folder uses the smb protocol. I managed to connect it in the following way. The most important thing was to write version 1.0 (vers=1.0). It didn't work without it! I tried to solve the issue for 2 days.

version: "3"

services:
  redis:
    image: redis
    restart: always
    container_name: 'redis'
    command: redis-server
    ports:
      - '6379:6379'
    environment:
      TZ: "Europe/Moscow"

  celery:
    build:
      context: .
      dockerfile: celery.dockerfile
    container_name: 'celery'
    command: celery --broker redis://redis:6379 --result-backend redis://redis:6379 --app worker.celery_worker   worker --loglevel info
    privileged: true
    environment:
      TZ: "Europe/Moscow"
    volumes:
      - .:/code
      - nas:/mnt/nas
    links:
      - redis
    depends_on:
      - redis

volumes:
  nas:
    driver: local
    driver_opts:
      type: cifs
      o: username=user,password=pass,**vers=1.0**
      device: "//192.168.10.10/main"
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda