Skip to content

Instantly share code, notes, and snippets.

@kahidna
Last active November 16, 2022 16:03
Show Gist options
  • Select an option

  • Save kahidna/7088d83e18867ce4082d56567127e590 to your computer and use it in GitHub Desktop.

Select an option

Save kahidna/7088d83e18867ce4082d56567127e590 to your computer and use it in GitHub Desktop.
docker compose using nfs v4 as volume
version: '3.5'
services:
nfs-server:
image: 'itsthenetwork/nfs-server-alpine:4'
container_name: nfs
hostname: nfs
ports:
- 2049:2049
environment:
- SHARED_DIRECTORY=/nfsshare
restart: always
privileged: true
volumes:
- ./nfs-mount:/nfsshare
networks:
- nfs_net
networks:
nfs_net:
name : nfs_net
version: "3.5"
services:
webapp:
image: kahidna/docker-nginx-php:7.4
container_name: webapp
hostname: webapp
ports:
- "80:80"
volumes:
- type: volume
source: webapp_nfs
target: /var/www/app
volume:
nocopy: true
webapp2:
image: kahidna/docker-nginx-php:7.4
container_name: webapp2
hostname: webapp2
ports:
- "8080:80"
volumes:
- type: volume
source: webapp2_nfs
target: /var/www/app
volume:
nocopy: true
volumes:
webapp_nfs:
driver_opts:
type: "nfs"
o: "vers=4.2,addr=192.168.200.225,nolock,soft,rw" # adjust the ip address
device: ":/webapp" # makesure on your nfs already have this folder
webapp2_nfs:
driver_opts:
type: "nfs"
o: "vers=4.2,addr=192.168.200.225,nolock,soft,rw" # adjust the ip address
device: ":/webapp2" # makesure on your nfs already have this folder too
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment