Run shell script on docker from shared volume

牧云@^-^@ 提交于 2019-12-06 06:05:58
VonC

Just to be sure, try and exec as root, with a tty, in a command shell:

docker exec -it -u root localserver_web_1 sh -c '/root/scripts/define_applications.sh'

If it does not work, check at least its presence and content through docker exec:

docker exec -it -u root localserver_web_1 sh -c 'ls -alrt /root/scripts'
docker exec -it -u root localserver_web_1 sh -c 'cat /root/scripts/define_applications.sh'

Also inspect the image to check its ENTRYPOINT (similar to the check for its CMD):

docker inspect --format='{{.Config.Entrypoint}}' <image:tag>

The OP Jon Schwartz confirms in the comments:

this was a pebkac error.
The script is actually called define-applications.sh, not define_applications.sh.
The cat line showed me my issue. When it could see the script through ls, I knew it should be able to get to it. When it couldn't cat out, I realized what happened.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!