【问题标题】:Unspecified error (0x80004005) while running a Docker build运行 Docker 构建时出现未指定的错误 (0x80004005)
【发布时间】:2020-01-03 12:24:23
【问题描述】:

想到 docker https://hub.docker.com/?overlay=onboarding 的入门第一步,我在运行构建命令时遇到了一个问题

docker build -t <user>/cheers2019 .

错误发生在第 6 步,代码错误 (0x80004005)。我正在使用 windows 容器在 windows 上运行 docker。

完整的错误代码:

Sending build context to Docker daemon  13.31kB
Step 1/9 : FROM golang:1.11-alpine AS builder
 ---> e116d2efa2ab
Step 2/9 : RUN apk add --no-cache git
 ---> Using cache
 ---> 07f79e350f69
Step 3/9 : RUN go get github.com/pdevine/go-asciisprite
 ---> Using cache
 ---> cfe4fd4064c3
Step 4/9 : WORKDIR /project
 ---> Using cache
 ---> 4ba87d64456e
Step 5/9 : COPY cheers.go .
 ---> Using cache
 ---> 486d7602dccf
Step 6/9 : RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o cheers cheers.go
 ---> Running in b77dee3bd612
container b77dee3bd612319c299e077116fc68ccf7f166246f85138b0e1cc0e074c8cb2b encountered an error during CreateProcess: failure in a Windows system call: Unspecified error (0x80004005)
[Event Detail: failed to run runc create/exec call for container b77dee3bd612319c299e077116fc68ccf7f166246f85138b0e1cc0e074c8cb2b: exit status 1 Stack Trace:
github.com/Microsoft/opengcs/service/gcs/runtime/runc.(*container).startProcess
        /go/src/github.com/Microsoft/opengcs/service/gcs/runtime/runc/runc.go:580
github.com/Microsoft/opengcs/service/gcs/runtime/runc.(*runcRuntime).runCreateCommand
        /go/src/github.com/Microsoft/opengcs/service/gcs/runtime/runc/runc.go:471
github.com/Microsoft/opengcs/service/gcs/runtime/runc.(*runcRuntime).CreateContainer
        /go/src/github.com/Microsoft/opengcs/service/gcs/runtime/runc/runc.go:113
github.com/Microsoft/opengcs/service/gcs/core/gcs.(*gcsCore).ExecProcess
        /go/src/github.com/Microsoft/opengcs/service/gcs/core/gcs/gcs.go:351
github.com/Microsoft/opengcs/service/gcs/bridge.(*Bridge).execProcess
        /go/src/github.com/Microsoft/opengcs/service/gcs/bridge/bridge.go:637
github.com/Microsoft/opengcs/service/gcs/bridge.(*Bridge).execProcess-fm
        /go/src/github.com/Microsoft/opengcs/service/gcs/bridge/bridge.go:253
github.com/Microsoft/opengcs/service/gcs/bridge.HandlerFunc.ServeMsg
        /go/src/github.com/Microsoft/opengcs/service/gcs/bridge/bridge.go:72
github.com/Microsoft/opengcs/service/gcs/bridge.(*Mux).ServeMsg
        /go/src/github.com/Microsoft/opengcs/service/gcs/bridge/bridge.go:146
github.com/Microsoft/opengcs/service/gcs/bridge.(*Bridge).ListenAndServe.func2.1
        /go/src/github.com/Microsoft/opengcs/service/gcs/bridge/bridge.go:335
runtime.goexit
        /usr/lib/go/src/runtime/asm_amd64.s:1333 Provider: 00000000-0000-0000-0000-000000000000] extra info: {"CommandArgs":["/bin/sh","-c","CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags \"-static\"' -o cheers cheers.go"],"WorkingDirectory":"/project","Environment":{"GOLANG_VERSION":"1.11.13","GOPATH":"/go","HOSTNAME":"b77dee3bd612","PATH":"/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"},"CreateStdInPipe":true,"CreateStdOutPipe":true,"CreateStdErrPipe":true,"ConsoleSize":[0,0],"OCISpecification":{"ociVersion":"1.0.1-dev","process":{"user":{"uid":0,"gid":0},"args":["/bin/sh","-c","CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags \"-static\"' -o cheers cheers.go"],"env":["PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","HOSTNAME=b77dee3bd612","GOLANG_VERSION=1.11.13","GOPATH=/go"],"cwd":"/project","capabilities":{"bounding":["CAP_CHOWN","CAP_DAC_OVERRIDE","CAP_FSETID","CAP_FOWNER","CAP_MKNOD","CAP_NET_RAW","CAP_SETGID","CAP_SETUID","CAP_SETFCAP","CAP_SETPCAP","CAP_NET_BIND_SERVICE","CAP_SYS_CHROOT","CAP_KILL","CAP_AUDIT_WRITE"],"effective":["CAP_CHOWN","CAP_DAC_OVERRIDE","CAP_FSETID","CAP_FOWNER","CAP_MKNOD","CAP_NET_RAW","CAP_SETGID","CAP_SETUID","CAP_SETFCAP","CAP_SETPCAP","CAP_NET_BIND_SERVICE","CAP_SYS_CHROOT","CAP_KILL","CAP_AUDIT_WRITE"],"inheritable":["CAP_CHOWN","CAP_DAC_OVERRIDE","CAP_FSETID","CAP_FOWNER","CAP_MKNOD","CAP_NET_RAW","CAP_SETGID","CAP_SETUID","CAP_SETFCAP","CAP_SETPCAP","CAP_NET_BIND_SERVICE","CAP_SYS_CHROOT","CAP_KILL","CAP_AUDIT_WRITE"],"permitted":["CAP_CHOWN","CAP_DAC_OVERRIDE","CAP_FSETID","CAP_FOWNER","CAP_MKNOD","CAP_NET_RAW","CAP_SETGID","CAP_SETUID","CAP_SETFCAP","CAP_SETPCAP","CAP_NET_BIND_SERVICE","CAP_SYS_CHROOT","CAP_KILL","CAP_AUDIT_WRITE"]}},"root":{"path":"rootfs"},"hostname":"b77dee3bd612","mounts":[{"destination":"/proc","type":"proc","source":"proc","options":["nosuid","noexec","nodev"]},{"destination":"/dev","type":"tmpfs","source":"tmpfs","options":["nosuid","strictatime","mode=755","size=65536k"]},{"destination":"/dev/pts","type":"devpts","source":"devpts","options":["nosuid","noexec","newinstance","ptmxmode=0666","mode=0620","gid=5"]},{"destination":"/sys","type":"sysfs","source":"sysfs","options":["nosuid","noexec","nodev","ro"]},{"destination":"/sys/fs/cgroup","type":"cgroup","source":"cgroup","options":["ro","nosuid","noexec","nodev"]},{"destination":"/dev/mqueue","type":"mqueue","source":"mqueue","options":["nosuid","noexec","nodev"]},{"destination":"/dev/shm","type":"tmpfs","source":"shm","options":["nosuid","noexec","nodev","mode=1777"]}],"linux":{"resources":{},"namespaces":[{"type":"mount"},{"type":"network"},{"type":"uts"},{"type":"pid"},{"type":"ipc"}],"maskedPaths":["/proc/asound","/proc/acpi","/proc/kcore","/proc/keys","/proc/latency_stats","/proc/timer_list","/proc/timer_stats","/proc/sched_debug","/proc/scsi","/sys/firmware"],"readonlyPaths":["/proc/bus","/proc/fs","/proc/irq","/proc/sys","/proc/sysrq-trigger"]},"windows":{"layerFolders":["C:\\ProgramData\\Docker\\lcow\\072ca1f3855a32f3e3b24c2fe4ca8dea9853d4fb64207407094332a2d6541458","C:\\ProgramData\\Docker\\lcow\\c45071b2eff55610a9d9b3f430b8e5fa3ff65465e59b8d5a63a61e744ca94c48","C:\\ProgramData\\Docker\\lcow\\6890c90396b8fcd14669837530eef071ec5e3f10dda6724478c7ab1b58752307","C:\\ProgramData\\Docker\\lcow\\a1998eef0068aac5fb61f53e87ce8d6d46eaf5c83f7eab36cb745fb57ad72e8a","C:\\ProgramData\\Docker\\lcow\\f311f4698a5c1eb5e8800ef04c6066177112d76afc18d089fcf2cd5642712a01","C:\\ProgramData\\Docker\\lcow\\5e7e640cace36a63707967e7109604dacc800b8163eb04a4be7f346ff38ba867","C:\\ProgramData\\Docker\\lcow\\a2a8b17328e92e236a3d30841abed7b815188a3d63e2432272f772acda4ec75d","C:\\ProgramData\\Docker\\lcow\\d774068efa88052dab131c32c40832302f547dd4737738ca19873e0c3bed0074","C:\\ProgramData\\Docker\\lcow\\b433fd6793fe572e509619d719280574a3b1860dbcc647ec6629695666227ca5","C:\\ProgramData\\Docker\\lcow\\b77dee3bd612319c299e077116fc68ccf7f166246f85138b0e1cc0e074c8cb2b"],"hyperv":{},"network":{"endpointList":["0FFBAC8D-5E31-4C4F-A753-85C5148C437D"],"allowUnqualifiedDNSQuery":true}}}}

知道我应该如何在 docker 中运行我的构建吗?

【问题讨论】:

  • 我不得不使用“winpty docker run -it --rm user/cheers2019”来运行它,但构建通过了我。我正在使用“Git for windows”又名 MINGW64 作为命令外壳,也许可以尝试使用不同的外壳。您是否仍在使用兼容版本的 Windows?不支持家庭。
  • @job3dot5 我使用的是 Windows 10 专业版。我在 cygwin 中使用 winpty 尝试了该命令,但遇到了同样的错误。大多数时候,我使用常规的 windows cmd 或 powershell。虽然我可以运行我下载的预构建,但不能自己制作它们是非常不方便的。
  • 您的“桌面版 Docker”版本是多少?我最近尝试了最新的,但我遇到了问题,现在我回到了 2.0.0.3 版本也许可以试试。
  • @job3dot5 我正在使用最新版本(2.1.0.2),但正如您指出的那样,使用旧版本可能会解决我的问题。如果我遇到更多问题,我会回来的。感谢您的帮助!

标签: docker docker-build


【解决方案1】:

我正在尝试更改实验。

检查:Docker version 在控制台中如果实验在客户端和服务器中都是错误的。

然后你可以在 C:\Users\.docker 中更改 在 config.json 你改变 experimental":"enabled" 然后在 daemon.json 你改变 "experimental": true 然后保存后我再次运行。 docker build -t &lt;user&gt;/cheers2019 .

【讨论】:

    【解决方案2】:

    我遇到了完全相同的错误。我不知道是不是因为在安装过程中我检查了“仅 Windows 容器”,但它在 Docker For Windows 中切换到了 Windows 容器。

    所以解决方法是点击switch to Linux container,然后我全部清理:

    docker system prune
    

    然后我再次运行:

    docker build -t <user>/cheers2019 .
    

    现在它对我有用。 这是我的 Docker 版本:

    docker version
    Client: Docker Engine - Community
     Version:           19.03.5
     API version:       1.40
     Go version:        go1.12.12
     Git commit:        633a0ea
     Built:             Wed Nov 13 07:22:37 2019
     OS/Arch:           windows/amd64
     Experimental:      true
    
    Server: Docker Engine - Community
     Engine:
      Version:          19.03.5
      API version:      1.40 (minimum version 1.12)
      Go version:       go1.12.12
      Git commit:       633a0ea
      Built:            Wed Nov 13 07:29:19 2019
      OS/Arch:          linux/amd64
      Experimental:     true
     containerd:
      Version:          v1.2.10
      GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
     runc:
      Version:          1.0.0-rc8+dev
      GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
     docker-init:
      Version:          0.18.0
      GitCommit:        fec3683
    

    【讨论】:

      【解决方案3】:

      在 Windows 10 上,我在当前问题和以下问题中报告了相同的问题:NPM Install doesn't work in Docker

      为了解决这个问题,我结合了两种解决方案:

      1. @JPBlanc(切换到 Linux 容器
      2. @Muhammad(在命令行和配置文件中禁用实验性

      我是怎么做到的:

      1) 切换到 Linux Containers:在任务栏上,右键单击 docker 图标,然后单击如下所示的选项:

      2) 在命令行中禁用“实验功能”:打开 docker/settings 并点击 命令行

      3) Disable Experimental setting on configuration file::在 docker/settings 上,点击 Docker Engine 并确认 experimental 设置为错误:

      希望对您有所帮助。 干杯

      【讨论】:

        【解决方案4】:

        在 Notepad++ 等工具中用 LF for Windows 替换 CRLF 字符并重新运行。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2022-07-13
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2014-08-27
          相关资源
          最近更新 更多