这可能与https://github.com/atmoz/sftp/blob/master/entrypoint#L36进行的参数解析有关。
但我正试图创建一个带有空格的目录:
我尝试了一些例子:
docker run -d atmoz/sftp:alpine-3.7 user:password:::Inbound - Test Dir
...
[entrypoint] Parsing user data: "user:password:::Inbound"
Creating mailbox file: No such file or directory
[entrypoint] Creating directory: /home/user/Inbound
[entrypoint] Parsing user data: "-"
[entrypoint] ERROR: Invalid username "-", do not match required regex pattern: [A-Za-z0-9._][A-Za-z0-9._-]{0,31}
docker run -d atmoz/sftp:alpine-3.7 user:password:::"Inbound - Test Dir"
...
[entrypoint] Creating directory: /home/user/Inbound
[entrypoint] Creating directory: /home/user/-
[entrypoint] Creating directory: /home/user/Test
[entrypoint] Creating directory: /home/user/Dir
docker run -d atmoz/sftp:alpine-3.7 "user:password:::Inbound - Test Dir"
...
[entrypoint] Creating directory: /home/user/Inbound
[entrypoint] Creating directory: /home/user/-
[entrypoint] Creating directory: /home/user/Test
[entrypoint] Creating directory: /home/user/Dir
docker run -d atmoz/sftp:alpine-3.7 user:password:::Inbound\ -\ Test\ Dir
...
[entrypoint] Creating directory: /home/user/Inbound
[entrypoint] Creating directory: /home/user/-
[entrypoint] Creating directory: /home/user/Test
[entrypoint] Creating directory: /home/user/Dir
docker run -d atmoz/sftp:alpine-3.7 user:password:::'Inbound - Test Dir'
...
[entrypoint] Creating directory: /home/user/Inbound
[entrypoint] Creating directory: /home/user/-
[entrypoint] Creating directory: /home/user/Test
[entrypoint] Creating directory: /home/user/Dir
IFS=, read
进行分割,整个过程似乎非常小心。尝试使用bash -x /entrypoint
覆盖docker entrypoint以查看发生了什么。read
没有-r
标志,您可以使用它。请尝试双重转义'user:password:::Inbound\ -\ Test\ Dir'
。 - KamilCukfor dirPath in ${dirArgs[@]}
无法处理包含空格的路径名。 - chepner