我正在尝试在Windows 10企业版上以管理员身份运行docker命令:
docker-compose exec --user magento2 web find /var/www/sample-data -type d -exec chmod g+ws {} \;
但我得到了错误:
find: missing argument to `-exec'
我试图通过使用''或“”逃脱:
docker-compose exec --user magento2 web "find /var/www/sample-data -type d -exec chmod g+ws {} \;"
但它抛出一个异常
rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:262: starting container process caused "exec: \"find /var/www/sample-data -type d -exec chmod g+ws {} \\\\;\": sta
t find /var/www/sample-data -type d -exec chmod g+ws {} \\;: no such file or directory"
我该如何解决这个问题?通常,当我将此命令插入容器时-一切正常。
最佳答案
使用sh代替:
docker-compose exec --user magento2 web sh -c 'find /var/www/sample-data -type d -exec chmod g+ws {} \;'
关于docker - 具有find -exec选项的docker exec(查找: `-exec'缺少参数),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44826054/