[Unit] Description=Samba After=network.target samba-build.service Wants=network.target samba-build.service # Start/stop this unit when the target is started/stopped PartOf=samba.target # Start Samba only if at least one share configuration file exists ConditionPathExistsGlob=/etc/quadlets/samba/smb.conf.d/*shares.conf [Container] ContainerName=samba # Image Image=localhost/samba:latest AutoUpdate=local # Security User=0 # Storage Volume=/var/lib/quadlets/samba/data:/var/lib/samba:Z Volume=/var/lib/quadlets/samba/log:/var/log/samba:Z Volume=/etc/quadlets/samba/smb.conf.d:/etc/samba/smb.conf.d:Z Volume=/run/quadlets/samba/passwd:/etc/passwd:Z Volume=/run/quadlets/samba/group:/etc/group:Z Volume=/run/quadlets/samba/shadow:/etc/shadow:Z # Heads up ! You need to mount the volumes you want to share in a drop-in configuration file ! # Network Network=host # Samba debug level Exec=--debuglevel=1 # Health check HealthCmd=smbclient -t 3 -N -L //127.0.0.1 HealthInterval=30s HealthTimeout=10s HealthStartPeriod=30s HealthRetries=3 [Service] # The /etc/shadow file cannot be copied by systemd-tmpfiles (because of SELinux) so we need to copy it before starting the container ExecStartPre=/bin/cp /etc/shadow /run/quadlets/samba/shadow [Install] WantedBy=samba.target