Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/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
Macos Docker Hello Wold-oci运行时错误_Macos_Docker - Fatal编程技术网

Macos Docker Hello Wold-oci运行时错误

Macos Docker Hello Wold-oci运行时错误,macos,docker,Macos,Docker,我试图理解Docker,我在OSX上的~/dockerfiles/test上有一个非常简单的Dockerfile FROM scratch RUN echo "Hello world" > ~/helloworld.txt CMD ["cat", "~/helloworld.txt"] 当我尝试为这个文件构建一个映像时,比如 docker build -t simple . 我在构建过程中遇到一个错误 错误输出 Sending build context to Docker daemo

我试图理解Docker,我在OSX上的
~/dockerfiles/test
上有一个非常简单的Dockerfile

FROM scratch
RUN echo "Hello world" > ~/helloworld.txt
CMD ["cat", "~/helloworld.txt"]
当我尝试为这个文件构建一个映像时,比如

docker build -t simple .
我在构建过程中遇到一个错误

错误输出

Sending build context to Docker daemon 2.048 kB
Step 1 : FROM scratch
 ---> 
Step 2 : RUN echo "Hello world" > ~/helloworld.txt
 ---> Running in fc772fd39d45
oci runtime error: exec: "/bin/sh": stat /bin/sh: no such file or directory
关于我为什么要面对这个问题,有什么建议吗?

你开始(空图像),你正在使用

cat
需要运行
/bin/sh
(它将分叉进程并加载动态库)


注意:默认情况下,
ENTRYPOINT
/bin/sh-c
,但文档“”显示对于临时图像,
ENTRYPOINT
为空

作为评论:


这个问题的快速解决方法是从debian:latest改为
,或者甚至从busybox:latest改为
,如果大小重要的话

当前使用的图像是

FROM alpine:3.4

该映像只有5 MB,并且可以访问比其他基于BusyBox的映像更完整的包存储库。

问题的快速解决方法正在从debian:latest
变为类似于
,或者甚至从BusyBox:latest
变为
,如果大小重要的话。@BMitch谢谢。我已将您的评论包含在答案中,以提高可视性。我会用阿尔卑斯山。