A self-hosted container optimized for MacOS Time Machine backups.
623
Repository: https://github.com/4lbertojordan/timemachine
A simple Docker-based Samba server optimized for macOS Time Machine backups. Provides a reliable and secure Time Machine destination for local network backups.
Time Machine backups are compatible with MacOS:
Create .env.timemachine in your repository root: (You can copy from variables_file_example.txt in this repo)
# Samba user and password
SMB_USER=backup_user_here
SMB_PASSWORD=your_secure_password_here
SMB_UID=1000
SMB_GROUP=home
SMB_GID=1000
# Container timezone
TZ=Europe/Madrid
Set permission for time machine directory:
mkdir -p ./timemachine
chown 1000:1000 ./timemachine && chmod 700 ./timemachine
docker compose -p timemachine -f docker-compose.yml up -d
This Time Machine share is automatically discovered using Avahi (Bonjour) if not please follow these steps:
Open your terminal and run:
sudo tmutil setdestination -p "smb://jordancodes@YOUR_SERVER_IP/TimeMachine"
Enter your Samba password when prompted.
Open System Settings → General → Time Machine and ensure the Time Machine share is selected.
Start your first backup!
| Variable | Description | Example | Default |
|---|---|---|---|
SMB_USER | Samba username for Time Machine backups | backup_user | jordancodes |
SMB_PASSWORD | Samba password (leave empty to skip password setup) | secure_pass | (empty) |
SMB_UID | Linux user ID for the Samba user | 1000 | 1000 |
SMB_GROUP | Linux group for the Samba user | home | home |
SMB_GID | Linux group ID for the Samba group | 1000 | 1000 |
TZ | Container timezone (for log timestamps) | Europe/Madrid | UTC |
The server configuration is defined in timemachine/smb_timemachine.conf.
Key Settings:
/timemachine (inside container)[TimeMachine]fruit:time machine = yesNetwork Security:
I recommend allowing only trusted networks:
127.0.0.1 (localhost)192.168.XXX.0/24 (local network example - adjust to your network)10.8.0.0/24 (VPN network example - adjust to your VPN)Check if Samba is running:
docker compose -p timemachine -f docker-compose.yml ps
Verify port is listening:
netstat -an | grep 445
Check Samba logs:
docker logs timemachine
Ensure credentials match .env.timemachine:
SMB_USERSMB_PASSWORDmemory limit in docker-compose.ymlEnsure the timemachine directory has proper permissions:
# linux host
ls -la ./timemachine/
# Should be owned by the user running Docker
You can exclude folders from Time Machine backups:
NOTE: I detect that tmutil commands may require some time to reflect any information.
# Show latest backup
tmutil latestbackup
# List all backups
tmutil listbackups
# Check backup size
tmutil calculatedrift
Content type
Image
Digest
sha256:a897ab255…
Size
65.2 MB
Last updated
8 months ago
docker pull jord4ncodes/timemachine