For a while now I’ve wanted to share files between my OSX / Macbook Pro laptop, and one (or ideally several) of my Ubuntu Linux PCs.
Why?
Because my laptop has 256gb of hard disk space, and that is consumed at an alarmingly fast rate when recording, and rendering videos.
I’ve tried, and failed, to set up file sharing on Ubuntu on numerous occasions. It is, of course, due to something (or several compounding somethings) I have been doing wrong, but I neither have the patience, nor desire to figure out exactly what.
Enter Docker. Saviour of hair follicles. Provider of solutions.
File Sharing Ubuntu Style, With Docker
Let’s cut right to the chase. Here is some configuration:
# docker-compose.yml
version: '3.4'
services:
samba:
image: dperson/samba
networks:
- default
tmpfs:
- /tmp
restart: unless-stopped
stdin_open: true
tty: true
ports:
- 139:139
- 445:445
volumes:
- "/path/to/my/local/folder:/mnt/share1:rw"
- "/another/local/directory:/share2:rw"
- "/home/chris/you/get/the/idea:/mnt/share3:rw"
command: '-w workgroup -u "chris;chris" -s "share1;/mnt/share1;no;no;no;chris;chris" -s "share2;/mnt/share2;no;no;no;chris;chris" -s "share3;/mnt/share3;no;no;no;chris;chris"'
networks:
default:
Essentially to make this work you need Docker, and Docker Compose installed on the PC (Ubuntu in my case) that you want to share data from.
There are some changes you will need to make.
Make sure each of the volumes match the path to a real directory on your computer.
The part before the colon is on your local PC.
The part after the colon is where that directory will be available inside the resulting running Docker container.
Customise the username and password appropriately.
You can find out what all the no;no;no
bits mean in the documentation.
Then put the code from above into a file called docker-compose.yml
somewhere on your computer. Once saved off to a file, run docker-compose up
(or docker-compose up -d
to run in the background) and away you go.
Your Ubuntu File Server For Mac
Once you have your shiny new Ubuntu Samba File Server up and running, how do you connect to it from your Mac?
Pop in the IP address, or (perhaps more nicely) the name of your Ubuntu PC.
The share name corresponds with whatever you called the share in the command
section of your docker-compose.yml
file.
Once you type in the full path to your share, click Connect.
After a second or two you should see a prompt. Enter the credentials to the share you created in your docker-compose.yml
file.
Bonza. You are now connected.
At this point you should have read / write access to the share. This is what I wanted, and allows me to copy all my video files over to the network drive, rather than store them on my over priced, under provisioned hard disk.