如何从另一个docker容器ubuntu启动docker

如何从另一个docker容器ubuntu启动docker,ubuntu,docker,dockerfile,Ubuntu,Docker,Dockerfile,我有一个詹金斯在ubuntu docker容器中运行。为了通过构建进行停靠,我还需要在这个容器中运行docker 我的问题是我不明白如何启动守护程序docker: Dockerfile: FROM ubuntu # this is a non-interactive automated build - avoid some warning messages ENV DEBIAN_FRONTEND noninteractive # update dpkg repositories RUN

我有一个詹金斯在ubuntu docker容器中运行。为了通过构建进行停靠,我还需要在这个容器中运行docker 我的问题是我不明白如何启动守护程序docker:

Dockerfile:

FROM ubuntu

# this is a non-interactive automated build - avoid some warning 

messages
ENV DEBIAN_FRONTEND noninteractive

# update dpkg repositories
RUN apt-get update 

# install wget
RUN apt-get install -y wget
RUN apt-get update -qq && apt-get install -qqy \
apt-transport-https \
ca-certificates \
curl \
tar \
lxc \
iptables

# Install Docker from Docker Inc. repositories.
RUN apt-get update && apt-get install -y docker.io

#install jenkins

我发现,这不是:

   RUN apt-get update && apt-get install -y docker.io    
但是

不需要jenkinsSlave

我发现,它不是:

   RUN apt-get update && apt-get install -y docker.io    
但是


不需要jenkinsSlave

您应该使用官方
docker:dind
图像并从主机文件夹
-v/var/run/docker.sock:/var/run/docker.sock
传递套接字,您需要在jenkins slave而不是主jenkins上使用官方
docker:dind
图像并从主机文件夹传递套接字/var/run/docker.sock:/var/run/docker.sock在jenkins从属设备上需要它,而不是在主jenkins上
   RUN curl -sSL https://get.docker.com/ | sh