运行 base image 失败
来源:3-3 DIY一个Base Image

三湘浪子
2019-06-17
你好!老师。
上述操作都是在Centos 7.4中操作;已经成功的创建了base images,但是缺无法正常执行,百度了一圈没找到相应的答案,看提示好像是没有匹配到相应的文件或者目录,这个是什么意思? 还请老师有时间能解答一二,万分感谢!
写回答
3回答
-
麦兜搞IT
2019-06-20
编译的时候一定要加 -static
[vagrant@localhost ~]$ gcc hello.c -o hello -static [vagrant@localhost ~]$ ls Dockerfile hello hello.c [vagrant@localhost ~]$ docker build -t test . Sending build context to Docker daemon 868.9kB Step 1/3 : FROM scratch ---> Step 2/3 : ADD hello / ---> Using cache ---> dbb689ce285c Step 3/3 : CMD ["/hello"] ---> Using cache ---> e3cee979b3f8 Successfully built e3cee979b3f8 Successfully tagged test:latest [vagrant@localhost ~]$ docker run -it test hello docker [vagrant@localhost ~]$
00 -
三湘浪子
提问者
2019-06-18
是的;老师我所有的操作都跟下面的操作一模一样,还请老师查看,我早上又复现了一遍昨天的过程,我觉得和您的操作没什么太大的区别,但是build出来的内容就是无法run。我的虚拟机可以远程,如果老师方便远程的话,我就将相应的账号口令发给您。
022019-06-19 -
麦兜搞IT
2019-06-18
请问您在centos里直接运行 ./hello 是可以的么?
00
相似问题