Docker Community Forums

Share and learn in the Docker community.

Mounted external device not showing inside docker volume

docker

(Ahetesolut) #1

I need to access usb-storage devices inside a running docker container.

Im running Debian on the host and have tried multiple linux-containers. If I first mount the device(usb-stick) on my host-system mount /dev/sda1 /media/sda1 and then docker run -it -v /media:/media the device shows up normaly, but i need to be able to change the usb-sticks at runntime. Running the container with --privileged=true doesnt change anything ether.

I can umount /dev/sda1 on my host-system and mount the same device or another device on the host but the container won’t show the new devices.
Writing other files via touch or mkdir to the /media/ directory does work as expected(visible for host and container).
This seems to only affect changes in volumes of running containers.

docker version:

Client:
 Version:	17.12.0-ce
 API version:	1.35
 Go version:	go1.9.2
 Git commit:	c97c6d6
 Built:	Wed Dec 27 20:11:19 2017
 OS/Arch:	linux/amd64

Server:
 Engine:
  Version:	17.12.0-ce
  API version:	1.35 (minimum version 1.12)
  Go version:	go1.9.2
  Git commit:	c97c6d6
  Built:	Wed Dec 27 20:09:54 2017
  OS/Arch:	linux/amd64
  Experimental:	false

docker info:

Containers: 3
 Running: 2
 Paused: 0
 Stopped: 1
Images: 1
Server Version: 17.12.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 89623f28b87a6004d4b785663257362d1658a729
runc version: b2567b37d7b75eb4cf325b77297b140ea686ce8f
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.0-6-amd64
Operating System: Debian GNU/Linux 9 (stretch)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.957GiB
Name: xxxx
ID: YSPJ:7CFT:2IDR:S3ZK:LQKH:OLCA:NB7L:RP5R:JRHA:OT3X:LZ3S:ZQO7
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false