docker - 不能在容器内制作容器?
问题描述
我在容器内,我正在尝试使用 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"}
尝试了其他图像,同样的错误出现。
解决方案
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
推荐阅读
- reactjs - react Invalid hook call although the hook call is in the function body?
- c++ - 从输入中读取行
- reactjs - How to test a controlled input (via Redux state) that dispatches an action on its onChange handler?
- function - Reflect dropdown balances to another sheet
- linux - how can i debug bash scripting and lynx problem?
- python - Using python to make an auto clicker
- python - 使用 Django 在一个 html 表中显示来自两个不同模型的数据
- xamarin.forms - 为选择器创建搜索/过滤器
- django - 用户如何在我的平台中向另一个用户发送一个来自的用户 - django
- javascript - 部署在 serverless 中的 Next.js 应用程序不支持 ISR