Self hosted nfs ( network file system ) that are not dependent on any cloud provider.
File system present somewhere on host machine open on a network.

# ssh into EC2 machine
ssh -i ~/.ssh/id_rsa_aws [email protected]
Install Docker on EC2 machine
Install docker compose on ubuntu
How to Install Docker Compose on Ubuntu (Step-by-Step Guide) | DigitalOcean
Create docker compose file to start NFS server inside docker container in EC2 achine
vi docker-compose.yml
docker-compose.yml
version: '3.7' # Docker Compose Version
services: # Define a service named nfs-server
nfs-server: # Ecah service is a container managed by docker compose
image: itsthenetwork/nfs-server-alpine:latest # Docker image with NFS Server (system that allows multiple containers to share file over a network )
privileged: true # Give extra permissions to this container since NFS requires it
environment:
SHARED_DIRECTORY: /exports # this dir will be exposed over NFS
volumes:
- /home/ubuntu/data:/exports:rw # mount local dir ./data into container at exports with read write permission
ports:
- '2049:2049'
restart: unless-stopped # Restart if docker crashes
mkdir data
sudo docker compose up
This will start networked file system on port 2049. Obviously you can’t visit port 2049 since it not an http request but your file is now exposed via NFS.
