[email protected]:whohoo/docker.gitcd ./samba./config/users.txt add your ftp username and password./docker-compose.yml add your ftp local path in volumesdocker-compose up -d --buildWhen first run the container, it would genrate a smb.conf file in ./config/ folder. You can change your samba's configuration and dont' forget to restart the container.
./config/users.txtusername:password:/path_in_container:uid:gid
username: the ftp user name (required)password: the ftp user password (required)/path_in_container: opional, if not specify, the default value is /home/${username},uid: optional, your can specify the user's uid, the uid should be unique.gid: optional, your can specify the group's gid. the default value is 100 [users group]共享文件夹配置说明:
[myShare]
comment = 这里是备注, 当hover在共享目录上时, 显示备注
path = /share/user1
browseable = yes
valid users = test2, wally, @wally
guest ok = no
writable = yes
write list = wally,test2
create mask = 0765
path: 这里是指docker里的路径, 在docker-compose.yml中指定volumes来映射到本地系统路径browseable : 当值为no的时候, 共享目录不可见, 但可通过\\xxx.xxx.xxx.xxx\myShare的方式直接访问, 默认为yesguest ok or public: 值yes|no, 当为yes的时候, 可通过访客账号访问共享目录valid users: 默认为空, 表示所有用户都有权限访问, 指定用户用逗号分隔, 可以用@组名的方式来添加组用户writable: yes当前目录是否可写入, 默认为nowrite list: 给于指定用户读写权限,create mask or directory mask: 用户新建的文件或目录所拥有的文件权限available: 是否启用共享目录, yes|nowritable, write list等属性外, unix文件用户权限也同样需要同等的相应的权限方可访问与读写adduser, 还需要通过smbpasswd 或pdbedit添加用户, 也就是说samba里的用户需要在系统里有对应的用户smb -F -S没问题, Samba 4.8(Alpine 3.8)版本后, 一定要加上参数**-i, 如smbd -i -F -S, 如果省去-i参数, 则smb会弹出exit_daemon: daemon failed to start: Failed to create session, error code 1错误提示. 但加上-i**参数后, 非windows系统无法连上共享服务器, 现在的解决方式是运行smbd 不带任何参数, 然后加上 while true; do sleep 1000; done 这命令让程序持续执行. 否则docker container会因为命令执行完成退出.Dockerfile文件第三行, 修改为FROM alpine:3.7 , 然后修改docker-entrypoint.sh文件, 把smdb 加上参数, 如:smdb -F -S, 再把while true; do sleep 1000; done这代码删除就可以了.docker-compose exec samba smbpasswd -d XXXXX
XXXXX should be replace with your username
docker-compose exec samba smbpasswd -e XXXXX
Sometime it can't fetch anything, when run apk add in Apline. In that case, you need change ./Dcokerfile file. please see below:
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
&& apk add --no-cache vsftpd \
&& ...
Content type
Image
Digest
Size
14.3 MB
Last updated
almost 6 years ago
docker pull whohoo/samba