简体   繁体   English

如何在Docker Windows中编辑Linux容器配置并观察其哈希值?

[英]How to edit Linux containers configs and observe it hashes in Docker Windows?

I installed Docker on Windows . 我在Windows上安装了Docker It's switched to Switched to Linux containers . 它已切换到Switched to Linux containers

When I type in my console: docker inspect e3a934c54979 I see an information: 当我在控制台中键入内容时: docker inspect e3a934c54979我看到一条信息:

[
    {
        ...
        "Image": "sha256:2359fa12fdedef2af79d9b836a26175808d4b1433b5e7022d2d73c72b2a43b60",
        "ResolvConfPath": "/var/lib/docker/containers/e3a934c549799d9ec45d65ad6aa73bba8fad924215087a9c9c60535ef2a5c2e8/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/e3a934c549799d9ec45d65ad6aa73bba8fad924215087a9c9c60535ef2a5c2e8/hostname",
        "HostsPath": "/var/lib/docker/containers/e3a934c549799d9ec45d65ad6aa73bba8fad924215087a9c9c60535ef2a5c2e8/hosts",
        "LogPath": "/var/lib/docker/containers/e3a934c549799d9ec45d65ad6aa73bba8fad924215087a9c9c60535ef2a5c2e8/e3a934c549799d9ec45d65ad6aa73bba8fad924215087a9c9c60535ef2a5c2e8-json.log",
        "Name": "/festive_edison",          
        ...
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {
                "80/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "80"
                    }
                ]
            },
            ...
        },
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/10f5348d5bfa76612ab30d1a253f17a6989fcd3f7ce23642b313c49f99a95f44-init/diff:/var/lib/docker/overlay2/028eac1b0f37fd3be798d222f7d1da48a40f0ef9c4470709e63c4c8f322a477f/diff:/var/lib/docker/overlay2/d15e7ce0f29f82d6d3b9537980b766c32e7f6ffc81374cdb26fede3872afed1e/diff:/var/lib/docker/overlay2/efab543606225e581832ef6e2b732a78c82b2f6d9fe662babe09b188f600dd72/diff:/var/lib/docker/overlay2/263366359e8a86cc6c009f70fa00a158dbcbcfd2a4e31d9538c559dd82e29b10/diff:/var/lib/docker/overlay2/32ea6c48b53f4846284e1baac83dffcfb039a53a8d2f33ac2728691160f5d100/diff:/var/lib/docker/overlay2/685745d44609453debf484b2ccf63035532b334e75b9f18a00c5e1253e18841a/diff:/var/lib/docker/overlay2/e30c0a304544255bc9eba90dfb720c332e168b4972df926a79ef27df707889fd/diff:/var/lib/docker/overlay2/a5743532bc060895f0a495249182787322400a1a33fd187b3210895e1ca83129/diff",
                "MergedDir": "/var/lib/docker/overlay2/10f5348d5bfa76612ab30d1a253f17a6989fcd3f7ce23642b313c49f99a95f44/merged",
                "UpperDir": "/var/lib/docker/overlay2/10f5348d5bfa76612ab30d1a253f17a6989fcd3f7ce23642b313c49f99a95f44/diff",
                "WorkDir": "/var/lib/docker/overlay2/10f5348d5bfa76612ab30d1a253f17a6989fcd3f7ce23642b313c49f99a95f44/work"
            },
            "Name": "overlay2"
        },
        ...
    }
]

But Windows doesn't have those directories. 但是Windows没有这些目录。 It only has "MobyLinuxVM.vhdx" which, I think, contains this stuff. 我认为它仅包含“ MobyLinuxVM.vhdx”,其中包含这些内容。

My question is how to edit "config.json" and "hostconfig.json" in this case? 我的问题是在这种情况下如何编辑“ config.json”和“ hostconfig.json”? How do I view a GUID-json.log? 如何查看GUID-json.log? How do I view container's hashes ( /var/lib/docker/aufs/diff )? 如何查看容器的哈希值( /var/lib/docker/aufs/diff )?

Information from https://blog.jongallant.com/2017/11/ssh-into-docker-vm-windows/ 来自https://blog.jongallant.com/2017/11/ssh-into-docker-vm-windows/的信息

In a Windows command prompt enter: 在Windows命令提示符下,输入:

docker run --privileged -it -v /var/run/docker.sock:/var/run/docker.sock jongallant/ubuntu-docker-client docker run --privileged -it -v /var/run/docker.sock:/var/run/docker.sock jongallant / ubuntu-docker-client

docker run --net=host --ipc=host --uts=host --pid=host -it --security-opt=seccomp=unconfined --privileged --rm -v /:/host alpine /bin/sh docker run --net = host --ipc = host --uts = host --pid = host -it --security-opt = seccomp = unconfined --privileged --rm -v /:/ host alpine / bin / sh

chroot /host chroot /主机

From here you'll have access to the /var/lib/Docker/containers/ directories for the hostconfig.json and other files. 从这里,您可以访问hostconfig.json和其他文件的/ var / lib / Docker / containers /目录。

暂无
暂无

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

相关问题 Docker for Windows如何运行Linux容器? - How does Docker for Windows run Linux containers? In Docker Desktop for windows 10 with WSL2, where does docker containers live & how Linux containers can run a java app, but not windows nanoserver? - In Docker Desktop for windows 10 with WSL2, where does docker containers live & how Linux containers can run a java app, but not windows nanoserver? 参考 Windows 容器的名称来自 Docker 桌面中的 Linux 容器 - Reference Windows containers by name from Linux containers in Docker Desktop 如何访问在Windows OS的Docker工具箱Linux容器中创建的项目目录? - How can I access the project directories that are created in the Docker toolbox Linux containers on my Windows OS? 如何在Docker Hub中过滤基于Windows或Linux的容器? - How can I filter on Windows-based or Linux-based containers within Docker Hub? Docker 命令行切换到在 Windows Core 机器上运行 linux 容器 - Docker command line to switch to running linux containers on Windows Core machine Docker windows 容器中的塑料 - Plastic in Docker windows containers 如何从 windows 主机看到从 docker linux 容器内部创建的符号链接(如果需要,可能涉及 samba) - How can I make symlinks made from inside docker linux containers to be seen from a windows host (maybe involving samba, if needed) 如何使用 Windows 的 Docker 为 Windows 容器配置 DNS? - How to configure DNS for Windows containers using Docker for Windows? "Docker for Windows 容器环境变量" - Docker for Windows Containers environment variables
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM