docker で NFS Server と Client を動かしたときのメモ

手順

network

1
docker network create nfs-net

NSF-Server

1
2
3
mkdir nfsshare

docker run -d --name nfs --net nfs-net --privileged -v nfsshare:/nfsshare -e SHARED_DIRECTORY=/nfsshare itsthenetwork/nfs-server-alpine:latest

NFS-Client

  • Client host start docker container run -it --rm --net nfs-net --name ubuntu --privileged ubuntu:latest bash

client install + 検証

  • login

    1
    
    docker exec -ti nfs /bin/bash
  • nfs-client install

    1
    2
    
    apt update
    apt install -y nfs-client
  • 検証 ``` mkdir /mnt/nfs mount.nfs4 -v nfs:/ /mnt/nfs

touch /mnt/nfs/hoge ll /mnt/nfs

umount /mnt/nfs ll /mnt/nfs

   ```

参考

https://hawksnowlog.blogspot.com/2019/07/run-nfs-server-on-docker.html