Docker inside Docker 基于 Alpine Linux
Study From
https://hub.docker.com/_/docker/
感慨一句 这些人真牛B ..
简单测试
拉取镜像
docker pull docker:dind
运行镜像
docker run -it --privileged --name dind -d docker:dind
查看镜像
[root@CentOS75 ~]# docker exec -it some-docker sh
/ # docker version
Client:
Version: 18.05.-ce
API version: 1.37
Go version: go1.9.2
Git commit: f150324
Built: Wed May ::
OS/Arch: linux/amd64
Experimental: false
Orchestrator: swarm Server:
Engine:
Version: 18.05.-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.10.1
Git commit: f150324
Built: Wed May ::
OS/Arch: linux/amd64
Experimental: false
/ #
其实也可以查看这个机器的版本信息
vi /etc/os-release NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.7.
PRETTY_NAME="Alpine Linux v3.7"
HOME_URL="http://alpinelinux.org"
BUG_REPORT_URL="http://bugs.alpinelinux.org"
github上面有完整的dockerfile文件 我用centos 的改了半天死活不行
https://github.com/docker-library/docker/blob/9ecb1c3a6bd766b69eb1858ef721f62fbd930a2b/18.06-rc/dind/Dockerfile
内容为
FROM docker:18.06-rc # https://github.com/docker/docker/blob/master/project/PACKAGERS.md#runtime-dependencies
RUN set -eux; \
apk add --no-cache \
btrfs-progs \
e2fsprogs \
e2fsprogs-extra \
iptables \
xfsprogs \
xz \
# pigz: https://github.com/moby/moby/pull/35697 (faster gzip implementation)
pigz \
; \
# only install zfs if it's available for the current architecture
# https://git.alpinelinux.org/cgit/aports/tree/main/zfs/APKBUILD?h=3.6-stable#n9 ("all !armhf !ppc64le" as of 2017-11-01)
# "apk info XYZ" exits with a zero exit code but no output when the package exists but not for this arch
if zfs="$(apk info --no-cache --quiet zfs)" && [ -n "$zfs" ]; then \
apk add --no-cache zfs; \
fi # TODO aufs-tools # set up subuid/subgid so that "--userns-remap=default" works out-of-the-box
RUN set -x \
&& addgroup -S dockremap \
&& adduser -S -G dockremap dockremap \
&& echo 'dockremap:165536:65536' >> /etc/subuid \
&& echo 'dockremap:165536:65536' >> /etc/subgid # https://github.com/docker/docker/tree/master/hack/dind
ENV DIND_COMMIT 52379fa76dee07ca038624d639d9e14f4fb719ff RUN set -ex; \
apk add --no-cache --virtual .fetch-deps libressl; \
wget -O /usr/local/bin/dind "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind"; \
chmod +x /usr/local/bin/dind; \
apk del .fetch-deps COPY dockerd-entrypoint.sh /usr/local/bin/ VOLUME /var/lib/docker
EXPOSE ENTRYPOINT ["dockerd-entrypoint.sh"]
CMD []
带安装docker部分的 dockerfile
FROM alpine:3.7 RUN apk add --no-cache \
ca-certificates # set up nsswitch.conf for Go's "netgo" implementation (which Docker explicitly uses)
# - https://github.com/docker/docker-ce/blob/v17.09.0-ce/components/engine/hack/make.sh#L149
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf ENV DOCKER_CHANNEL test
ENV DOCKER_VERSION 18.06.-ce-rc3
# TODO ENV DOCKER_SHA256
# https://github.com/docker/docker-ce/blob/5b073ee2cf564edee5adca05eee574142f7627bb/components/packaging/static/hash_files !!
# (no SHA file artifacts on download.docker.com yet as of -- though) RUN set -ex; \
# why we use "curl" instead of "wget":
# + wget -O docker.tgz https://download.docker.com/linux/static/stable/x86_64/docker-17.03.1-ce.tgz
# Connecting to download.docker.com (54.230.87.253:)
# wget: error getting response: Connection reset by peer
apk add --no-cache --virtual .fetch-deps \
curl \
tar \
; \
\
# this "case" statement is generated via "update.sh"
apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
x86_64) dockerArch='x86_64' ;; \
armhf) dockerArch='armel' ;; \
aarch64) dockerArch='aarch64' ;; \
ppc64le) dockerArch='ppc64le' ;; \
s390x) dockerArch='s390x' ;; \
*) echo >& "error: unsupported architecture ($apkArch)"; exit ;;\
esac; \
\
if ! curl -fL -o docker.tgz "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/${dockerArch}/docker-${DOCKER_VERSION}.tgz"; then \
echo >& "error: failed to download 'docker-${DOCKER_VERSION}' from '${DOCKER_CHANNEL}' for '${dockerArch}'"; \
exit ; \
fi; \
\
tar --extract \
--file docker.tgz \
--strip-components \
--directory /usr/local/bin/ \
; \
rm docker.tgz; \
\
apk del .fetch-deps; \
\
dockerd -v; \
docker -v COPY modprobe.sh /usr/local/bin/modprobe
COPY docker-entrypoint.sh /usr/local/bin/ ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["sh"]
Docker inside Docker 基于 Alpine Linux的更多相关文章
- 支持HTTP2的cURL——基于Alpine的最小化Docker镜像
cURL是我喜欢的开源软件之一.虽然cURL的强大常常被认为是理所当然的,但我真心地认为它值得感谢和尊重.如果我们的工具箱失去了curl,那些需要和网络重度交互的人(我们大多数人都是这样的)将会陷入到 ...
- Alpine Linux
Alpine Linux Docker镜像基于Alpine Linux操作系统,后者是一个面向安全的轻型Linux发行版.不同于通常Linux发行版,Alpine Linux采用了musl libc和 ...
- [转帖]Docker里运行Docker docker in docker(dind)
Docker里运行Docker docker in docker(dind) http://www.wantchalk.com/c/devops/docker/2017/05/24/docker-in ...
- Docker系列之(三):Docker微容器Alpine Linux
1. 前言 使用Docker创建容器时,基础镜像通常选择Ubuntu或Centos,不管哪个镜像的大小都在100MB以上. Alpine Linux是一个面向安全的轻型的Linux发行版. Alpin ...
- docker --Docker微容器Alpine Linux
Alpine Linux的官网: http://www.alpinelinux.org/ #官方 https://pkgs.alpinelinux.org/packages #官方提供的安装包 ...
- 【docker部署】基于linux的centos操作系统部署安装docker容器
一.docker介绍 容器是轻量级的,包含应用运行所需所有东西(代码.库.运行时环境.系统设置,以及依赖关系)的独立的包.每个容器都部署于它自己的 CPU.内存.块 I/O,以及网络资源上,所有这些都 ...
- 修改alpine Linux的Docker容器的时区
适用对象 使用 Alpine Linux 发行版的 Docker 镜像容器. 仅仅适用于没有安装uclibc的系统. 修改步骤 进入容器命令行 # docker exec -it container_ ...
- Docker微容器Alpine Linux
Alpine 操作系统是一个面向安全的轻型 Linux 发行版. 它不同于通常 Linux 发行版,Alpine 采用了 musl libc 和 busybox 以减小系统的体积和运行时资源消耗,但功 ...
- 如何使用 Jenkins、GitHub 和 Docker 在 Azure 中的 Linux VM 上创建开发基础结构
若要将应用程序开发的生成和测试阶段自动化,可以使用持续集成和部署 (CI/CD) 管道. 本教程介绍如何在 Azure VM 上创建 CI/CD 管道,包括如何: 创建 Jenkins VM 安装并配 ...
随机推荐
- 广州商学院Python正方教务系统爬虫(获取个人信息成绩课表修改密码)
使用python的requests库简单爬取,使用xpath解析内容 可以获取个人信息.个人照片.成绩单和课表 github地址:https://github.com/PythonerKK/GZCC- ...
- Python2.7-copy_reg
copy_reg 模块,提供了在 pickle 或是 copy 特定对象时,可以运行一个指定的函数,作为对象的构造器 模块方法: copy_reg.constructor(object):声明一个可调 ...
- Android GridView使用View.GONE只隐藏内容而不隐藏空间的解决方案
最近在处理GridView的时候遇到这样一个问题:Android手机客户端接收服务端返回的一串数据(数据条数不固定),这串数据不一定都要显示到GridView上,也就是说有一部分内容需要隐藏掉,即有一 ...
- expect 批量执行命令
在跳板机上执行脚本,登录到远程机器分区格式化挂载命令 #!/bin/bashpasswd='engine'/usr/bin/expect <<-EOFset time 40spawn ss ...
- day53
JS常用类 一.Number 1.常用数字 整数:10 小数:3.14 科学计数法:1e5 | 1e-5 正负无穷:Infinity | -Infinity 2.常用进制 二进制:0b1010 八进制 ...
- 将公钥部署到远程Git仓库(coding.net)
步骤: 1.下载git通用客户端并且安装. 2.右键,在弹出的对话框中选择Git Bash 3.创建本地ssha)在弹出的终端输入ssh-keygen -t rsa -C "username ...
- Newtonsoft.Json.Linq对象读取DataSet数据
Newtonsoft.Json.Linq对象读取DataSet数据: private void button4_Click(object sender, EventArgs e) { ...
- 20155202张旭 Exp6 信息收集与漏洞扫描
20155202张旭 Exp6 信息收集与漏洞扫描 一.实践目标与内容 1.实践目标: 掌握信息搜集的最基础技能. 具体有: 各种搜索技巧的应用 DNS IP注册信息的查询 基本的扫描技术:主机发现. ...
- 2017-2018-2 20155204《网络对抗技术》EXP5 MSF基础应用
一.基础问题回答 用自己的话解释什么是exploit,payload,encode exploit:利用靶机系统中的一些漏洞进行攻击的过程,除去前期准备的工作,这一步是实施攻击. payload:载荷 ...
- 20155235 王玥 《基于Arm实验箱的接口测试和应用》 课程设计报告
20155235 王玥 <基于Arm实验箱的接口测试和应用> 课程设计报告 一.设计方案及可行性分析 熟悉 Linux 开发环境 多线程应用程序设计 串行端口程序设计 中断实验 二.详细设 ...