Last active
November 16, 2022 16:03
-
-
Save kahidna/7088d83e18867ce4082d56567127e590 to your computer and use it in GitHub Desktop.
docker compose using nfs v4 as volume
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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