我有一个可以在shell中完美运行的命令:



现在,我想在启动时从Docker容器运行此命令。因此,在Dockerfile的底部,我有:



但是,容器退出时出现错误:

/sbin/start-stop-daemon: /sbin/start-stop-daemon: cannot execute binary file

我认为CMD语法有问题。有任何想法吗?

最佳答案

通过运行start-stop-daemon找出which start-stop-daemon的完整路径,然后使用:
CMD ["/full_path_to_the_bin_file/start-stop-daemon", "--quiet", "--oknodo", "--start", "--pidfile", "/run/my.pid", "--background", "--make-pidfile", "--exec", "/opt/socat-1.7.2.4/socat", "PTY,link=/dev/ttyMY,echo=0,raw,unlink-close=0", "TCP-LISTEN:9334,reuseaddr,fork"]
而不是CMD,您可能要使用ENTRYPOINT

关于docker - 将bash命令转换为docker CMD,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27740329/

10-16 22:48