2025-01-31, 04:19 PM
Well, I did something absolutely wacky, and it worked.
Here's how it breaks down: SMB support on Mac OS is just really unstable. I couldn't actually get it working using that. Instead, I baked a new container. I'll provide the dockerfile and entrypoint for reference if anyone is interested. But, with these changes, it mounts the SMB mount *within* the container, instead of mounting it in Mac OS and accessing it via a docker volume.
Here's how it works:
Added a new Dockerfile:
And the entrypoint
And an update to the compose service
By doing this, everything works and I'm able to scan the library. I think it might be a bit snappier as well. But that's not measured, just a feeling.
Here's how it breaks down: SMB support on Mac OS is just really unstable. I couldn't actually get it working using that. Instead, I baked a new container. I'll provide the dockerfile and entrypoint for reference if anyone is interested. But, with these changes, it mounts the SMB mount *within* the container, instead of mounting it in Mac OS and accessing it via a docker volume.
Here's how it works:
Added a new Dockerfile:
Code:
FROM jellyfin/jellyfin:latest
# Install CIFS utilities for mounting SMB shares
RUN apt-get update && \
apt-get install -y cifs-utils && \
apt-get clean
# Copy custom entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Override entrypoint
ENTRYPOINT ["/entrypoint.sh"]
And the entrypoint
Code:
#!/bin/bash
set -e
# Ensure required env vars are set
if [[ -z "$SMB_SERVER" || -z "$SMB_SHARE" || -z "$SMB_USER" || -z "$SMB_PASS" ]]; then
echo "Missing SMB environment variables! Exiting."
exit 1
fi
# Define mount point
MOUNT_POINT="/data"
# Create mount directory if it doesn’t exist
mkdir -p "$MOUNT_POINT"
# Attempt to mount SMB share
echo "Mounting SMB share: //$SMB_SERVER/$SMB_SHARE at $MOUNT_POINT..."
mount -t cifs "//$SMB_SERVER/$SMB_SHARE" "$MOUNT_POINT" \
-o username="$SMB_USER",password="$SMB_PASS",vers=3.0,uid=1000,gid=1000,iocharset=utf8,rw
# Ensure mount is successful
if ! mountpoint -q "$MOUNT_POINT"; then
echo "Failed to mount SMB share! Exiting."
exit 1
fi
echo "SMB share mounted successfully."
# Run the default Jellyfin entrypoint
exec /jellyfin/jellyfin
And an update to the compose service
Code:
jellyfin:
container_name: jellyfin
build:
context: .
dockerfile: Dockerfile
privileged: true
cap_add:
- SYS_ADMIN
- DAC_READ_SEARCH
devices:
- /dev/fuse
tmpfs:
- /run
- /tmp
network_mode: host
restart: unless-stopped
volumes:
- ./jellyfin-config:/config
ports:
- "8096:8096"
environment:
PUID: 1000
PGID: 1000
TZ: America/Los_Angeles
SMB_SERVER: my-server-name
SMB_SHARE: jellyfin
SMB_USER: username
SMB_PASS: password
By doing this, everything works and I'm able to scan the library. I think it might be a bit snappier as well. But that's not measured, just a feeling.