我有一个Git Bash脚本,它运行一些Docker命令来设置我的Shopware容器。其中一个命令使用docker exec
在容器内的路径上运行sudo chown
:
docker exec -it $SHOPWARE_CONTAINER_ID sudo chown www-data /var/www/html/custom/plugins/shopware-ai-demodata/src/Service/Generator/
字符串
当命令在容器中使用docker桌面运行时,这很好用。但是,如果我运行脚本,它会在Git Bash(Windows OS)中给出一个错误:
chown: cannot access 'C:/Program Files/Git/var/www/html/custom/plugins/shopware-ai-demodata/src/Service/Generator/': No such file or directory
型
它似乎试图直接在我的Windows主机上运行chown,而不是在Docker容器中运行,因为该路径显然不存在于Windows上。我如何通过脚本使此命令在shopware容器中工作?
1条答案
按热度按时间olmpazwi1#
这是Git bash试图将
/bin/sh
扩展为自己路径中的可执行文件。要禁用它,请将第一个斜杠加倍:字符串