解决dockerfile 创建镜像报 exec format error问题 及容器退出问题

[root@localhost etc]# docker run -it --name my_centos7_cklpost8.1  --net=host    centos7_cklpost6.0 /bin/bash 
standard_init_linux.go:211: exec user process caused "exec format error"
[root@localhost etc]# 
[root@localhost etc]# 
[root@localhost etc]# docker run -it --name my_centos7_cklpost8.2  --net=host    centos7_cklpost6.0
standard_init_linux.go:211: exec user process caused "exec format error"
failed to resize tty, using default size
 

1.调试方法, 不加d, 让前台运行.  docker run -itd --name my_centos7_cklpost8.2  --net=host    centos7_cklpost6.0

2. "exec format error" 是因为.sh里没添加 #!/bin/bash

3. 直接退出是因为 docker必须有一个前台进程在最后运行, 不然会误认为没事可做.  就类型c++程序里主进程里添加多个线程启动后要加 一个锁, 或是sleep(1000000000...). 这里取巧用个 touch tt.log  tail -f ./tt.log 作为前台

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章