[英]Docker in docker : docker run hello-world error operation not permitted
I got a message "docker: failed to register layer: ApplyLayer exit status 1 stdout: stderr: Error creating mount namespace before pivot: operation not permitted."我收到一条消息“docker: failed to register layer: ApplyLayer exit status 1 stdout: stderr: Error created mount namespace before pivot: operation not allowed。” when i tried to run hello-world.
当我尝试运行 hello-world 时。
I cannot find what is wrong..我找不到什么问题..
[step] [步]
docker run -it --privileged ubuntu:18.04 docker 运行 -it --特权 ubuntu:18.04
install docker on ubuntu:18.04在 ubuntu:18.04 上安装 docker
There are much easier ways to run docker commands inside a container:在容器内运行 docker 命令有很多更简单的方法:
DooD
:DooD
:run -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker ubuntu:20.04
once you run this you can try to run your docker commands it will work just fine but keep in mind!!运行此命令后,您可以尝试运行 docker 命令,它会正常工作,但请记住!
this does the same thing as if you run the commands from your host machine
这与从主机运行命令的作用相同
DinD
:DinD
:docker run -d --privileged --name docker \
-e DOCKER_TLS_CERTDIR=/certs \
-v docker-certs-ca:/certs/ca \
-v docker-certs-client:/certs/client \
docker:dind
then you can execute dood commands inside that container running:然后您可以在该容器内执行 dood 命令运行:
docker exec -it dood sh
This is a great alternative for you because it's lightweight and easy to setup!
这对您来说是一个很好的选择,因为它重量轻且易于设置!
You can find more here .你可以在这里找到更多。
In case you insist to use the Ubuntu:18.04 and installing docker inside of it, I would first say you haven't specified how you installed docker it should probably work if you followed how to install Docker on a Ubuntu machine , could be some volume mounting issue aswell, you can try to run these commands once the ubuntu container is created or just use a Dockerfile
: In case you insist to use the Ubuntu:18.04 and installing docker inside of it, I would first say you haven't specified how you installed docker it should probably work if you followed how to install Docker on a Ubuntu machine , could be some volume安装问题也是如此,您可以在创建 ubuntu 容器后尝试运行这些命令,或者只使用
Dockerfile
:
apt-get update &&\
apt-get install curl &&\
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - &&\
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" &&\
apt-cache policy docker-ce &&\
apt-get install -y docker-ce
and then running docker commands must work properly unless you have some network issues.然后运行 docker 命令必须正常工作,除非您有一些网络问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.