如何将构建docker容器的命令放入dockerfile? [英] How to put command of build docker container to dockerfile?

查看:79
本文介绍了如何将构建docker容器的命令放入dockerfile?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有脚本: docker run -it -p 4000:4000 bitgosdk/express:latest --disablessl -e test 如何将这个命令与参数一起放置到dockerfile中?

I have script: docker run -it -p 4000:4000 bitgosdk/express:latest --disablessl -e test how to put this command to dockerfile with arguments?

FROM bitgosdk/express:latest
EXPOSE 4000
???

推荐答案

通过您的Dockerfile内容.

在容器内运行的命令是:

The command running inside container is:

/ # ps -ef | more
PID   USER     TIME  COMMAND
    1 root      0:00 /sbin/tini -- /usr/local/bin/node /var/bitgo-express/bin/bitgo-express --disablessl -e test

命令之所以如此,是因为Dockerfile中设置的入口点是 ENTRYPOINT ["/sbin/tini",-","/usr/local/bin/node","/var/bitgo-express/bin/bitgo-express"] 和参数-disablessl -e test 是运行 docker run 命令时提供的参数.

The command is so because the entrypoint set in the Dockerfile is ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/node", "/var/bitgo-express/bin/bitgo-express"] and the arguments --disablessl -e test are the one provided while running docker run command.

可以使用 CMD 在您的Dockerfile中设置-disablessl -e test 参数:

The --disablessl -e test arguments can be set inside your Dockerfile using CMD:

CMD ["--disablessl", "-e","test"]

新的Dockerfile :

FROM bitgosdk/express:latest
EXPOSE 4000
CMD ["--disablessl", "-e","test"]

请参阅此内容以了解入口点和cmd .

这篇关于如何将构建docker容器的命令放入dockerfile?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆