I have a Linux host with a block device /dev/sdb
, and I want to mount the device to host's /mnt/sdb
.
My special need is that do this in a container but not in the host itself, and need not to mount the device into container also (for example -v
).
For example (does not work certainly):
$ docker run some-image mount /dev/sdb /mnt/sdb
Or absolutely this is impossible?
Map TCP port 80 in the container to port 8080 on the Docker host for connections to host IP 192.168. 1.100. Map UDP port 80 in the container to port 8080 on the Docker host. Map TCP port 80 in the container to TCP port 8080 on the Docker host, and map UDP port 80 in the container to UDP port 8080 on the Docker host.
You can expose a port through your Dockerfile or use --expose and then publish it with the -P flag. This will bind the exposed port to your Docker host on a random port (verified by running docker container ls ). You can expose a port through your Dockerfile or use --expose and then publish it with the -p 80:80 flag.
Docker supports adding/passing through devices to a container:
docker run --device=/dev/sdb
https://docs.docker.com/engine/reference/commandline/run/#add-host-device-to-container-device
You should be able to mount that device (outside docker), and then use said mounted folder in your docker run.
See issue 21485 as an illustration:
mount /dev/sdb /workspace
docker run --rm -v "/workspace:/workspace" some-image
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With