【问题标题】:Can we run Containers in Linux machine from docker Images built on windows machine?我们可以从 Windows 机器上构建的 docker 镜像在 Linux 机器上运行容器吗?
【发布时间】:2020-12-14 14:51:47
【问题描述】:

我们有 Windows 操作系统的 Jenkins Build 机器。 但是,我们有用于运行我们的应用程序的 Linux EC2 实例。 太害怕了,如果我们可以使用构建在 windows 上的 Docker 镜像在 Linux 机器中启动容器。

Windows 机器:

docker build -t "app-image-built-on-windows" .

Linux 机器:

docker run app-image-built-on-windows

那么 Docker 镜像跨平台兼容吗? 长期在PROD中使用,请给出答案。

【问题讨论】:

    标签: image docker operating-system containers cross-platform


    【解决方案1】:

    如果你的 docker 镜像是基于 linux 的,那么是的,你可以在 windows 上构建。

    Windows Subsystem for Linux (WSL) 2 引入了重大的架构变化,因为它是由 Microsoft 构建的完整 Linux 内核,允许 Linux 容器在没有仿真的情况下本地运行。

    如果您的构建成功,您可以在 linux 机器上运行容器。

    【讨论】:

    • 谢谢 Yuyanto,请告诉我从哪个 Windows 版本开始,这些架构更改是为了在 Windows 中完全支持 Linux 内核而进行的
    • 您好,在您的 docker 安装中,您可以[在 windows/linux 之间切换] (sujayopillai.com/2018/05/06/docker-tip.html)container 子系统。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-19
    • 2022-10-06
    • 2020-02-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多