【问题标题】:Docker fails to build image with exit code 139Docker 无法使用退出代码 139 构建映像
【发布时间】:2021-04-02 09:08:46
【问题描述】:

我正在尝试从 CentOS 6.9 构建映像。使用这个 Dockerfile:

FROM centos:6.9

RUN ls

但它一直失败,退出代码为 139,输出如下:

$ docker build -t centos-6.9 .
[+] Building 1.1s (7/7) FINISHED
 => [internal] load build definition from Dockerfile                                                                                             0.0s 
 => => transferring dockerfile: 72B                                                                                                              0.0s 
 => [internal] load .dockerignore                                                                                                                0.0s 
 => => transferring context: 2B                                                                                                                  0.0s 
 => [internal] load metadata for docker.io/library/centos:6.9                                                                                    0.6s 
 => [internal] load build context                                                                                                                0.1s 
 => => transferring context: 72B                                                                                                                 0.0s 
 => CACHED [1/3] FROM docker.io/library/centos:6.9@sha256:6fff0a9edc920968351eb357c5b84016000fec6956e6d745f695e5a34f18ecd2                       0.0s 
 => [2/3] COPY . .                                                                                                                               0.0s 
 => ERROR [3/3] RUN ls                                                                                                                           0.3s 
------
 > [3/3] RUN ls:
------
executor failed running [/bin/sh -c ls]: exit code: 139

我在跑步:

  • Windows 10 企业版 2004
  • Docker 桌面 3.0.0

【问题讨论】:

    标签: docker centos centos6 wsl-2


    【解决方案1】:

    这似乎是 WSL 2 的问题,其基础映像较旧,而不是 docker 或映像本身。

    1. 创建%userprofile%\.wslconfig 文件。

    2. 添加以下内容:

    [wsl2]
    kernelCommandLine = vsyscall=emulate
    
    1. 重启 WSL。 wsl --shutdown

    2. 重启 Docker 桌面。

    参考资料:

    1. https://github.com/microsoft/WSL/issues/4694#issuecomment-556095344
    2. https://github.com/docker/for-win/issues/7284#issuecomment-646910923
    3. https://github.com/microsoft/WSL/issues/4694#issuecomment-558335829

    【讨论】:

    • 我在 Hyper-V 基础上遇到了同样的问题。
    猜你喜欢
    • 2021-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多