我使用docker容器来构建和部署我的软件到ec2的集合。在部署脚本中,我构建我的软件,然后将其打包到docker镜像中。图像被推送到我的私人注册表,由我的生产ec2的拉,然后运行。所以基本上我需要在docker容器中运行docker。
I am using a docker container to build and deploy my software to a collection of ec2's. In the deployment script I build my software and then package it in a docker image. The image is pushed to my private registry, pulled by my production ec2's and then run. So essentially I will need to run docker within a docker container.
问题是我实际上不能在我的容器上启动docker。如果我尝试
The problem is that I can't actually start docker on my container. If I try
service docker start我获得
bash: service: command not found如果我尝试
docker -d我得到
2014/10/07 15:54:35 docker daemon: 0.11.1-dev 02d20af/0.11.1; execdriver: native; graphdriver: [e2feb6f9] +job serveapi(unix:///var/run/docker.sock) [e2feb6f9] +job initserver() [e2feb6f9.initserver()] Creating server 2014/10/07 15:54:35 Listening for HTTP on unix (/var/run/docker.sock) [error] attach_loopback.go:42 There are no more loopback device available. loopback mounting failed [e2feb6f9] -job initserver() = ERR (1) 2014/10/07 15:54:35 loopback mounting faileddocker容器上不存在service命令,因此我无法启动docker。我不知道我现在应该做什么,以启动docker,所以我有点陷在这里,任何帮助是赞赏。
The service command doesn't exist on the docker container so I can't start docker. I'm not sure what I should be doing now to start docker so I'm a bit stuck here, any help is appreciated.
更多信息
主机运行fedora 20(最终将在ec2上运行amazon linux)
Host machine is running fedora 20 (will eventually be running amazon linux on an ec2)
Docker容器正在运行centos 7.0
Docker container is running centos 7.0
Host正在运行Docker版本1.2.0,构建fa7b24f / 1.2.0
Host is running Docker version 1.2.0, build fa7b24f/1.2.0
容器正在运行docker- 0.11.1-22.el7.centos.x86_64
Container is running docker-0.11.1-22.el7.centos.x86_64
推荐答案如何在Docker中不运行docker主机,但是从你的docker容器?只需挂载您的docker.sock和docker二进制文件:
How about not running 'docker inside docker' and run docker on your host, but from within your docker container? Just mount your docker.sock and docker binary:
docker run -v /var/run/docker.sock:/run/docker.sock -v $(which docker):/ bin / docker [your image]
github/sameersbn/docker-gitlab 使用此方法来旋转docker容器,请查看此图像。
github/sameersbn/docker-gitlab uses this approach to spin up docker containers, take a look at this image.
您还可以查看: registry.hub.docker / u / mattgruter / doubledocker /
更新于2016年7月
最新的方法是使用 docker:dind image,如下所示: hub.docker/_/docker/
The most current approach is to use docker:dind image, as described here: hub.docker/_/docker/
简短摘要:
$ docker run --privileged --name some-docker -d docker:dind
然后: $ docker run --rm --link some-docker:docker docker info
更多推荐
在docker容器中运行docker?
发布评论