【Docker】runtime create failed: container_linux.go:345: 解决

-------------------------------------------------------------------------------------------------

|  欢迎关注个人公众号  zclinux_note  第一时间获取关于linux使用的技巧。探索Linux的奥秘   |

-------------------------------------------------------------------------------------------------

在docker中运行这样的命令:

[root@docker tomcat9]# docker exec 207464dba466 java -version
结果报错:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"java\": executable file not found in $PATH": unknown.

 

解决办法:

遇到这种问题,只能将exec换成run

[root@docker tomcat9]# docker run tomcat:9.0.21 java -version
docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"java\": executable file not found in $PATH": unknown.

[root@docker tomcat9]# docker run tomcat:9.0.21 /bin/sh -C && java -version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
[root@docker tomcat9]# 
 

你可能感兴趣的:(docker)