[英]Real location of docker windows container in a windows host?
Linux containers can be accessed via \\wsl.localhost\docker-desktop-data
, but what about windows containers ? Linux 容器可以通过
\\wsl.localhost\docker-desktop-data
访问,但是Windows 容器呢?
That said, it is worth mentioning that both the environment and the container are windows, so I also activated the Switch to Windows container option (in Docker)也就是说,值得一提的是,环境和容器都是windows,所以我也激活了Switch to Windows container选项(在Docker中)
That is, if there are 1000 files located in C:\Folder in Container A , I want to migrate this Container A containing not only the C:\Folder but all its contents to another host .也就是说,如果Container A中的C:\Folder中有 1000 个文件,我想将这个Container A不仅包含 C:\Folder 还包含其所有内容迁移到另一个主机。
From what I understand, a container has isolated files, this means that I can have another container with the same filenames but with different contents.据我了解,一个容器具有隔离文件,这意味着我可以拥有另一个具有相同文件名但内容不同的容器。
I want to access the files to perform the migration.我想访问文件以执行迁移。
Keyword![]() |
Theme![]() |
URL![]() |
---|---|---|
Windows container location ![]() |
This is pretty much the same question as mine.![]() |
Docker Virtual Hard Disk Location ![]() |
Windows container location ![]() |
If it differs from my question because it deals with answers that point to the Linux environment, not Windows![]() |
Where are Docker images stored on the host machine? ![]() |
I understand why you are asking this, but containers are a bit different than VMs.我明白你为什么要问这个,但容器与 VM 有点不同。 With VMs, you have a virtual disk that represents the virtual hard drive for the VM.
对于 VM,您有一个虚拟磁盘代表 VM 的虚拟硬盘驱动器。 With containers, what you have are layers that combined represent the container image, which is then used to build new container instances.
对于容器,您所拥有的是组合起来代表容器图像的层,然后用于构建新的容器实例。 The container image layers are stored, by default, on the C:\ProgramData folder.
默认情况下,容器图像层存储在 C:\ProgramData 文件夹中。 You can change that via the Docker CLI (not sure on Docker Desktop, it should be possible).
您可以通过 Docker CLI 更改它(在 Docker Desktop 上不确定,应该可以)。
Now, to your specific question:现在,针对您的具体问题:
If you want to move container images from one machine to another, the best alternative is to push the image to a registry (such as Docker Hub) to then pull it on another machine.如果您想将容器镜像从一台机器移动到另一台机器,最好的替代方法是将镜像推送到注册表(例如 Docker Hub),然后将其拉到另一台机器上。 Alternatively, you could rebuild your dockerfile on the other machine (might require other assets, such as the app folder, etc.)
或者,您可以在另一台机器上重建您的 dockerfile(可能需要其他资产,例如应用程序文件夹等)
If the goal is to change the Windows config, you should do that via dockerfile, not changing the config directly from the folder structure.如果目标是更改 Windows 配置,您应该通过 dockerfile 来完成,而不是直接从文件夹结构更改配置。 This is another main difference from VMs to containers.
这是从 VM 到容器的另一个主要区别。 By changing the dockerfile, you make this reproducible, and avoids any issues with the Windows runtime.
通过更改 dockerfile,您可以重现它,并避免 Windows 运行时出现任何问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.