我想在 docker-compose 中运行源代码command
,例如
command: ["source", "/etc/profile", ";", "/usr/local/tomcat/bin/catalina.sh", "run"]
错误是
ERROR: for pica-cat3 Cannot start service pica-cat3: b'OCI runtime create failed: container_linux.go:346: starting container process caused "exec: \\"source\\": executable file not found in $PATH": unknown'
我能做些什么?
答案1
使用嵌入在执行环境中的 shell 的内置命令。
如果/bin/sh
,则运行命令/bin/sh -c '. /etc/profile ; /usr/local/tomcat/bin/catalina.sh run
如果/bin/bash
,则运行命令/bin/bash -c '. /etc/profile ; /usr/local/tomcat/bin/catalina.sh run
如果/bin/csh
,则运行命令/bin/csh -c 'source /etc/profile ; /usr/local/tomcat/bin/catalina.sh run