Documents
How can I make an SMB network share accessible to a Docker container?
How can I make an SMB network share accessible to a Docker container?
Type
Answer
Status
Published
Created
Dec 3, 2025
Updated
Dec 3, 2025
Created by
Dosu Bot
Updated by
Dosu Bot

To make an SMB network share accessible to a Docker container, first mount the SMB share on your host system, then map that mounted directory into your container as a volume.

For example, on a typical Linux host, you can mount the SMB share with:

sudo mount -t cifs //server/share /mnt/smb \
  -o username=youruser,password=yourpassword,uid=$(id -u),gid=$(id -g)

Replace //server/share with your SMB path, /mnt/smb with your desired mount point, and set your credentials as needed.

Then, when running your Docker container, map the mounted directory:

docker run -v /mnt/smb:/data your-image

Or in Docker Compose:

services:
  your-service:
    image: your-image
    volumes:
      - /mnt/smb:/data

Note:

  • Ensure permissions are set correctly by matching the container's user/group IDs to those used to mount the share, or set PUID/PGID environment variables if your image supports them.
  • Using SMB/NFS for /config mounts is not supported by LinuxServer.io images, but is fine for general data volumes like /data or /media. See the LinuxServer.io documentation for more details.