Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Docker /bin/sh:service:在cent os 7上找不到命令_Docker_Centos_Dockerfile_Newrelic - Fatal编程技术网

Docker /bin/sh:service:在cent os 7上找不到命令

Docker /bin/sh:service:在cent os 7上找不到命令,docker,centos,dockerfile,newrelic,Docker,Centos,Dockerfile,Newrelic,在Dockerfile中生成此命令时: RUN service start newrelic-infra 我得到这个错误: /bin/sh:service:command未找到命令'/bin/sh-c service start newrelic infra'返回了一个非零代码:127 在Dockerfile中插入此yum-y安装initscripts&&yum clean all并执行RUN service start newrelic infra后, 我也遇到了同样的错误。您应该假设像se

在Dockerfile中生成此命令时:

RUN service start newrelic-infra
我得到这个错误:

/bin/sh:service:command未找到命令'/bin/sh-c service start newrelic infra'返回了一个非零代码:127

在Dockerfile中插入此
yum-y安装initscripts&&yum clean all
并执行
RUN service start newrelic infra
后,
我也遇到了同样的错误。

您应该假设像
service
systemctl
这样的命令在Docker中不起作用。即使
runservicestart
没有引发错误,运行进程的事实也不会在映像中持久化;下一个
运行
命令和任何最终的
docker运行
都不会运行该进程。@DavidMaze,你能解释一下为什么吗?