Mac上的Docker-OCI运行时创建失败:拒绝mkdir权限

时间:2018-11-23 04:43:33

标签: macos docker

尝试运行我的docker文件时。我收到以下错误。

docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"rootfs_linux.go:58: mounting \\\"/Users/hkatyal/go/src/github.com/purser/bin/amd64\\\" to rootfs \\\"/var/lib/docker/overlay2/c144a9b95f53811b456c7a4e84064bf4231a2a94afcf2c77b8c6d031c3f4bf87/merged\\\" at \\\"/var/lib/docker/overlay2/c144a9b95f53811b456c7a4e84064bf4231a2a94afcf2c77b8c6d031c3f4bf87/merged/go/bin/linux_amd64\\\" caused \\\"mkdir /var/lib/docker/overlay2/c144a9b95f53811b456c7a4e84064bf4231a2a94afcf2c77b8c6d031c3f4bf87/merged/go/bin/linux_amd64: permission denied\\\"\"": unknown.

我的Docker Cmd如下:

@docker run                                                            \
    -ti                                                                \
    -u $$(id -u):$$(id -g)                                             \
    -v $$(pwd)/.go:/go:$(DOCKER_MOUNT_MODE)                            \
    -v $$(pwd)/$(BUILD):/go/src/$(PRO)/$(BUILD):$(DOCKER_MOUNT_MODE)   \
    -v $$(pwd)/$(CMD):/go/src/$(PRO)/$(CMD):$(DOCKER_MOUNT_MODE)                     \
    -v $$(pwd)/$(PKG):/go/src/$(PRO)/$(PKG):$(DOCKER_MOUNT_MODE)                     \
    -v $$(pwd)/$(DEP):/go/src/$(PRO)/$(DEP):$(DOCKER_MOUNT_MODE)                     \
    -v $$(pwd)/bin/$(ARCH):/go/bin:$(DOCKER_MOUNT_MODE)                \
    -v $$(pwd)/bin/$(ARCH):/go/bin/linux_$(ARCH):$(DOCKER_MOUNT_MODE)  \
    -v $$(pwd)/.go/std/$(ARCH):/usr/local/go/pkg/linux_$(ARCH)_static:$(DOCKER_MOUNT_MODE)  \
    -w /go/src                                                 \
    golang:1.11                                                     \
    /bin/sh -c "                                                       \
        ARCH=$(ARCH)                                                   \
        VERSION=$(VERSION)                                             \
        PKG=$(PKG)                                                     \
        ./$(PRO)/$(BUILD)/build.sh                                               \
    "

Mac可以在Linux上正常运行此问题。我需要更改一些设置吗?

环境详细信息如下:

macOS Version: 10.13.6

Docker版本:

$  docker version
Client: Docker Engine - Community
 Version:           18.09.0
  API version:       1.39
  Go version:        go1.10.4
  Git commit:        4d60db4
  Built:             Wed Nov  7 00:47:43 2018
  OS/Arch:           darwin/amd64
  Experimental:      false

Server: Docker Engine - Community
Engine:
 Version:          18.09.0
 API version:      1.39 (minimum version 1.12)
 Go version:       go1.10.4
 Git commit:       4d60db4
 Built:            Wed Nov  7 00:55:00 2018
 OS/Arch:          linux/amd64
 Experimental:     true 

1 个答案:

答案 0 :(得分:0)

问题是Mac机器不是真正的Docker主机,而Mac上的Docker在VM上运行,而Docker卷不在路径中。

Details here