gpt4 book ai didi

Dockerfile : Command works in Dockerfile but not in shell script

转载 作者:行者123 更新时间:2023-12-02 19:44:52 29 4
gpt4 key购买 nike

关闭。这个问题需要details or clarity .它目前不接受答案。












想改进这个问题?通过 editing this post 添加详细信息并澄清问题.

1年前关闭。




Improve this question




我在我的 dockerfile 中运行一个 liquibase 命令,它成功执行。

CMD liquibase/liquibase/ --url=$My_URL --username $Username --password $Password --loglevel=$LogL --changeLogFile /changes/postgresql.xml update


但是,如果我执行这是一个 sh 脚本。

liquibase/liquibase/ --url=$My_URL --username $Username --password $Password --loglevel=$LogL --changeLogFile /changes/postgresql.xml update


然后我得到这个错误:

' (options must start with a '--')e.integration.commandline.Main - Unexpected error running Liquibase: Unexpected value 'update' (options must start with a '--')singException: Unexpected value 'update


我不明白为什么此命令在 Dockerfile 中按预期执行,但仅在 shell 脚本中部分运行。我的部分意思是该命令确实会打开 liquibase Jar 文件并显示 ASCII Logo 。但后来我看到“意外的值更新”错误。
关于如何更正 shell 脚本中的命令的任何想法?

最佳答案

看起来您在 liquibase/liquibase/末尾有多余的/。
此外,请确保定义了 shell 命令中使用的所有变量:

echo $My_URL
echo $Username
echo $Password
echo $LogL
如果没有,请通过以下方式导出它们
export Username=bob
export Password=caution_this_is_not_secure
export My_URL=...
...

关于Dockerfile : Command works in Dockerfile but not in shell script,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64145319/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com