简体   繁体   English

docker 运行 hello-world 失败,stderr:权限被拒绝

[英]docker run hello-world fails, stderr: permission denied

I have installed docker via https://get.docker.com/ and the process went fine but when I try to run it I'm receiving the error我已经通过https://get.docker.com/安装了 docker 并且过程正常但是当我尝试运行它时我收到错误

docker: failed to register layer: ApplyLayer exit status 1 stdout: stderr: permission denied. docker:注册层失败:ApplyLayer 退出状态 1 stdout:stderr:权限被拒绝。

lsb_release -a: lsb_release -a:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.5 LTS
Release:    16.04
Codename:   xenial

uname -a uname -a

Linux stage 4.15.18-1-pve #1 SMP PVE 4.15.18-16 (Mon, 23 Jul 2018 15:59:19 +0200) x86_64 x86_64 x86_64 GNU/Linux

docker version: docker版本:

Client:
 Version:           18.09.3
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        774a1f4
 Built:             Thu Feb 28 06:40:58 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.3
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       774a1f4
  Built:            Thu Feb 28 05:59:55 2019
  OS/Arch:          linux/amd64
  Experimental:     false

docker info: docker 信息:

Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 18.09.3
Storage Driver: vfs
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: e6b3f5632f50dbc4e9cb6288d911bf4f5e95b18e
runc version: 6635b4f0c6af3810594d2770f662f34ddc15b40d
init version: fec3683
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.15.18-1-pve
Operating System: Ubuntu 16.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 16GiB
Name: stage
ID: QFBZ:LSOW:2QT3:XGVI:4MIH:5BM7:7XR6:YKC7:JOMO:OWUW:T6YT:KVMA
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

docker -D run hello-world: docker -D 运行你好世界:

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Extracting [==================================================>]     977B/977B
docker: failed to register layer: ApplyLayer exit status 1 stdout:  stderr: permission denied.
See 'docker run --help'.

I don't have /etc/pve/lxc folder nor lxc command available as docker run hello-world still fails, permission denied seems to suggest to resolve it.我没有 /etc/pve/lxc 文件夹,也没有可用的 lxc 命令,因为docker run hello-world 仍然失败,permission denied似乎建议解决它。

I'm losing my mind around this error, please help!我对这个错误失去了理智,请帮忙!

You're maybe missing this step 您可能错过了这一步

sudo usermod -aG docker your-user

And pay attention to this: 并注意以下几点:

NOTE: Remember to log out and back in for this to take effect! 注意:请记住先注销然后再登录才能生效!

As docker is telling stderr: Permission denied 正如码头工人告诉stderr: Permission denied

Is McAfee antivirus running? McAfee防病毒软件正在运行吗? Specifically the isectpd.service (McAfee Endpoint Security for Linux Threat Prevention). 特别是isectpd.service (用于Linux威胁防护的McAfee Endpoint Security)。

If so this may cause pull to fail. 如果是这样,可能会导致拉拔失败。

Remove/Stop McAfee and retry. 删除/停止McAfee,然后重试。

I have the same issue when I try to deploy stack to Docker Swarm through GitLab DinD runner.当我尝试通过 GitLab DinD runner 将堆栈部署到 Docker Swarm 时,我遇到了同样的问题。

- sh deploy.sh
- echo $CI_BUILD_TOKEN | docker login -u gitlab-ci-token --password-stdin $CI_REGISTRY_IMAGE
- docker context create --docker host=$DEPLOYMENT_SSH_URL --description "Remote GitLab connection"  remote-gitlab
- docker context use remote-gitlab
- docker stack deploy --compose-file docker-stack.yml LevelUp

deploy.sh code deploy.sh代码

#!/bin/bash

which ssh-agent || apk add --no-cache openssh-client
which curl || apk --no-cache add curl

mkdir ~/.ssh/
echo "$KNOWNHOSTS" >> ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
eval $(ssh-agent -s)
echo "$SSH_PRIVATE_KEY" | base64 -d | ssh-add -

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM