栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Docker中启动Docker问题

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Docker中启动Docker问题

尝试在Docker 的Centos容器中继续起个dokcer来测试,但是在容器中运行任何docker命令,如docker ps,都会报错:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

意思Docker没启动,然后尝试去启动:

service docker start

还是

systemctl start docker

都会报错:

System has not been booted with systemd as init system (PID 1). Can’t operate.

然后查看init.d下只有readme,也没有其他启动命令

最后研究一圈发现是Docker内不支持继续起Docker,

其实也很好理解,如果可以一直套娃,岂不是无穷无尽。

You can’t () run Docker inside Docker containers or images. You can’t () start background services inside a Dockerfile. As you say, commands like systemctl and service don’t (*) work inside Docker anywhere. And in any case you can’t use any host-system resources, including the host’s Docker socket, from anywhere in a Dockerfile.

You need to redesign this Dockerfile so that it only installs the software and makes no attempt to start it. Ideally a container would start only a single server, and would run it in the foreground as its CMD; otherwise you might depend on things like supervisord to have multiple servers if you must. If your application heavily relies on being able to start things in Docker, you might find it much easier to install in a virtual machine.

(*) Technically there are ways to do all of these things, but they’re all tricky and complicated and have implications (up to potentially giving your container unrestricted root access over the host, and your container startup actively reconfiguring some low-level host details).

参考:

https://stackoverflow.com/questions/51857634/cannot-connect-to-the-docker-daemon-at-unix-var-run-docker-sock-is-the-docke

暑期编程PK赛 得CSDN机械键盘等精美礼品!
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1016790.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号