samba服务的容器镜像: elswork/samba
docker hub 页面: https://hub.docker.com/r/elswork/samba
docker compose 部署 samba
---
docker network create docker_network
cat << "EOF" >./docker-compose.yaml
version: "3"
services:
samba:
image: elswork/samba
container_name: samba
volumes:
- /home/your_user_name/documents/:/mount
ports:
- 139:139/tcp
- 445:445/tcp
command: |
-u "1000:1000:your_user_name:your_user_name:put-any-password-here" -s "SmbShare:/mount:rw:your_user_name"
restart: always
networks:
default:
name: docker_network
external: True
EOF
容器部署samba服务 注意事项
- /home/your_user_name/documents 目录拥有者 需要注意 ,我这里确保修改为1000:1000
- 替换your_user_name为你个人的名称
- 客户端读写挂载 mount -t cifs -o "rw,username=your_user_name,password=put-any-password-here" //nfs.xxx.com/SmbShare /home/your_user_name/documents
- 客户端只读挂载 mount -t cifs -o "ro,username=your_user_name,password=put-any-password-here" //nfs.xxx.com/SmbShare /home/your_user_name/documents
- //nfs.xxx.com/SmbShare 为NFS服务的地址,
- /home/your_user_name/documents 为客户端的本地目录
- 学习常规部署samba ,并结合https://hub.docker.com/r/elswork/samba 学习更多技巧