docker执行与查找-exec选项(查找:缺less参数“执行”)
我试图在Windows 10 Enterprise上以pipe理员身份运行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 {} \;'