简体   繁体   English

从 docker 容器获取 runc config.json

[英]Getting runc config.json from docker container

I am trying to create a runc container from a docker container.我正在尝试从 docker 容器创建一个 runc 容器。

I followed this blog post and was successfull in extracting the config.json from the running docker container.我关注了这篇博客文章,并成功地从正在运行的 docker 容器中提取了 config.json。

The issue is that问题是

  1. The path where I found the config.json was different then the references I found online我找到 config.json 的路径与我在网上找到的引用不同
  2. The same path does not work on a different host which has, as far as I can tell, the same docker version.相同的路径在不同的主机上不起作用,据我所知,该主机具有相同的 docker 版本。 On that host, I have not been able to find where the config.json is generated.在该主机上,我无法找到 config.json 的生成位置。

I have conflicting information on where to find the config.json, and am unable to find it on my host.我有关于在哪里可以找到 config.json 的冲突信息,并且无法在我的主机上找到它。

|config.json location                     | source                         |
|-----------------------------------------|--------------------------------------------|
|/run/docker/libcontainerd/<container id> | http://crunchtools.com/getting-ninja-runc/ |
|/var/run/docker/libcontainerd/<container id> |https://github.com/genuinetools/riddler |
|/var/run/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby/<container id> | my host #1 |
| ??? | my host #2 |

What other locations can I check, and how can I tell which one it will be?我还可以检查哪些其他位置,以及如何确定它将是哪个位置? Is this configured somewhere, does this depend on the version of docker, containerd, runc, or something else?这是在某处配置的,这是否取决于 docker、containerd、runc 或其他版本?

I found config.json here:我在这里找到了 config.json:

/run/containerd/io.containerd.runtime.v1.linux/moby/container_id/config.json

on ubuntu18.04, docker version:在 ubuntu18.04 上,docker 版本:

Client: Docker Engine - Community
 Version:           19.03.4
 API version:       1.40
 Go version:        go1.12.10
 Git commit:        9013bf583a
 Built:             Fri Oct 18 15:54:09 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.4
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.10
  Git commit:       9013bf583a
  Built:            Fri Oct 18 15:52:40 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

@lin.qian 's answer saves me hours. @lin.qian 的回答为我节省了几个小时。 config.json is now located in /run/containerd/io.containerd.runtime.v1.linux/moby/ rather than all the other locations mentioned in the question post. config.json 现在位于/run/containerd/io.containerd.runtime.v1.linux/moby/而不是问题帖子中提到的所有其他位置。

Actually if you further want to use this config file with runc, you need modify实际上,如果您还想将此配置文件与 runc 一起使用,则需要修改

  • root

and remove the following from "mounts"并从“坐骑”中删除以下内容

  • "/etc/hosts" “/etc/hosts”
  • "/etc/hostname" “/etc/主机名”
  • "/dev/shm" “/dev/shm”

and remove "hooks"并删除“钩子”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将docker-compose.yml转换为runc config.json - Convert docker-compose.yml to runc config.json Docker 密码存储在.docker/config.json - Docker password store in .docker/config.json Gitlab 运行程序无法使用来自 ~/.docker/config.json 的凭据进行身份验证 - Gitlab runner fails to authenticate with credentials from ~/.docker/config.json 如何将 GCP &gt; Container Registry 身份验证密钥添加到 Docker config.json? - How can i add GCP > Container Registry auth key to Docker config.json? .docker/config.json 与 .dockercfg - .docker/config.json vs .dockercfg Kubernetes 在执行 docker pull 时忽略 config.json - Kubernetes ignores config.json while doing docker pull Amazon Linux EC2 中没有 Docker config.json - No Docker config.json in Amazon Linux EC2 Docker 非 root 访问:加载配置文件时出错:stat /home/wu/.docker/config.json - Docker non-root access: Error loading config file:stat /home/wu/.docker/config.json 需要Docker授权令牌才能进行k8s部署,但不在.docker / config.json中 - Need docker authorization token for k8s deployment but not in .docker/config.json 当 docker 安装在 Z3D9454Z5F8E94B4D5429A 上时,我应该将 docker config.json 文件放在哪里? - Where do I place a docker config.json file when docker is installed as a snap on Ubuntu?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM