gpt4 book ai didi

docker - 跑 docker 导出

转载 作者:行者123 更新时间:2023-12-02 18:27:45 27 4
gpt4 key购买 nike

我使用 docker save <repository>:<tag> > image.rar 导出图像,然后使用 docker import image.rar 将其导入另一个系统。
我可以在运行 docker image ls 时看到图像,但是当我尝试运行它时,似乎在图像上找不到任何命令。
例如:

# docker run -ti -p 3000:3000 myimage:latest /bin/bash
docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown.
我注意到其他一些文章提到使用 docker inspect 来检查“Cmd”值,但无论出于何种原因,我都显示 null
[
{
"Id": "sha256:4e72a54a101b8acd79e2677180a616c8eda12c11833d346482a414e3e68247e3",
"RepoTags": [
"goku:latest"
],
"RepoDigests": [],
"Parent": "",
"Comment": "Imported from -",
"Created": "2019-08-08T05:42:16.776276679Z",
"Container": "",
"ContainerConfig": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": null,
"Cmd": null,
"Image": "",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": null
},
"DockerVersion": "19.03.1",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": null,
"Cmd": null,
"Image": "",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": null
},
"Architecture": "amd64",
"Os": "linux",
"Size": 2072840786,
"VirtualSize": 2072840786,
"GraphDriver": {
"Data": {
"MergedDir": "/var/lib/docker/overlay2/b44f261a6233b09181c456c250ea7b947602f79cdf4dd70670c13c40533167fc/merged",
"UpperDir": "/var/lib/docker/overlay2/b44f261a6233b09181c456c250ea7b947602f79cdf4dd70670c13c40533167fc/diff",
"WorkDir": "/var/lib/docker/overlay2/b44f261a6233b09181c456c250ea7b947602f79cdf4dd70670c13c40533167fc/work"
},
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:a5ad36e48c9cf4342adb59c532661fb1320a2f5b6be8c30469d483415529c750"
]
},
"Metadata": {
"LastTagTime": "2019-08-08T05:42:16.784693374Z"
}
}
]
我不太确定在导入过程中可能出了什么问题。我想我以前可能已经成功地做到了这一点,但也许没有。

最佳答案

尝试使用 docker load而不是 docker import你应该很好。

docker 保存 => docker 负载

docker 导出 => docker 进口

以上是正确的顺序

看下面的问题
https://github.com/moby/moby/issues/7352

关于docker - 跑 docker 导出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57469782/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com