Running Samba from Docker
Another ultralight NAS installation. Samba is the SMB server on Linux, introduced in 1992. Everyone needs storage, and samba is what we use for Windows storage. This one uses a small VM with Docker .
I run a lot of NAS VMs in my cluster. This is one ultralight NAS running in a small Docker VM.
What is Samba
“Samba is the standard Windows interoperability suite of programs for Linux and Unix.
Samba is Free Software licensed under the GNU General Public License, the Samba project is a member of the Software Freedom Conservancy.
Since 1992, Samba has provided secure, stable and fast file and print services for all clients using the SMB/CIFS protocol, such as all versions of DOS and Windows, OS/2, Linux and many others.
Samba is an important component to seamlessly integrate Linux/Unix Servers and Desktops into Active Directory environments. It can function both as a domain controller or as a regular domain member.” — samba.org
“Don't let the success of others discourage you. Let it inspire you.” - unknown
Installation
I use Dockge as my tool to deploy and manage Docker Compose files. Use a small VM 1 core, RAM 1 GiB, 8Gib Disk, and add a data disk of a proper size e.g., 256 GiB on a ZFS-2 device. You should install avahi on this VM.
Add the storage for the synchronized files
Add a virtual disk (sdb) and create a partition on it. Make a filesystem mkfs.ext4 /dev/sdb1
and mount it with sudo mount -t auto -v /dev/sdb1 /sync/
.
Find the UUID ls -l /dev/disk/by-uuid
and edit /etc/fstab
, add the line /dev/disk/by-uuid/<UUID> /sync ext4 defaults 0 2
. The fs_passno of 2 means check filesystem after the root filesystem is checked, for no check use 0
.
The root filesystem should be specified with a fs_passno of 1. Other filesystems should have a fs_passno of 2. Filesystems within a drive will be checked sequentially, but filesystems on different drives will be checked at the same time to utilize parallelism available in the hardware. Defaults to zero (don’t check the filesystem) if not present.
Samba configuration
This is the included default
If you need more advanced features, like multiple shares, you can modify the smb.conf
file in this repo, and bind mount it to the container like this:
volumes:
- /example/smb.conf:/etc/samba/smb.conf
Dockge files
References
Samba [1]
Samba homepage, getting started GitHub, used Image from Docker Hub ↩︎