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的更多相关文章

  1. 支持HTTP2的cURL——基于Alpine的最小化Docker镜像

    cURL是我喜欢的开源软件之一.虽然cURL的强大常常被认为是理所当然的,但我真心地认为它值得感谢和尊重.如果我们的工具箱失去了curl,那些需要和网络重度交互的人(我们大多数人都是这样的)将会陷入到 ...

  2. Alpine Linux

    Alpine Linux Docker镜像基于Alpine Linux操作系统,后者是一个面向安全的轻型Linux发行版.不同于通常Linux发行版,Alpine Linux采用了musl libc和 ...

  3. [转帖]Docker里运行Docker docker in docker(dind)

    Docker里运行Docker docker in docker(dind) http://www.wantchalk.com/c/devops/docker/2017/05/24/docker-in ...

  4. Docker系列之(三):Docker微容器Alpine Linux

    1. 前言 使用Docker创建容器时,基础镜像通常选择Ubuntu或Centos,不管哪个镜像的大小都在100MB以上. Alpine Linux是一个面向安全的轻型的Linux发行版. Alpin ...

  5. docker --Docker微容器Alpine Linux

    Alpine Linux的官网: http://www.alpinelinux.org/    #官方 https://pkgs.alpinelinux.org/packages  #官方提供的安装包 ...

  6. 【docker部署】基于linux的centos操作系统部署安装docker容器

    一.docker介绍 容器是轻量级的,包含应用运行所需所有东西(代码.库.运行时环境.系统设置,以及依赖关系)的独立的包.每个容器都部署于它自己的 CPU.内存.块 I/O,以及网络资源上,所有这些都 ...

  7. 修改alpine Linux的Docker容器的时区

    适用对象 使用 Alpine Linux 发行版的 Docker 镜像容器. 仅仅适用于没有安装uclibc的系统. 修改步骤 进入容器命令行 # docker exec -it container_ ...

  8. Docker微容器Alpine Linux

    Alpine 操作系统是一个面向安全的轻型 Linux 发行版. 它不同于通常 Linux 发行版,Alpine 采用了 musl libc 和 busybox 以减小系统的体积和运行时资源消耗,但功 ...

  9. 如何使用 Jenkins、GitHub 和 Docker 在 Azure 中的 Linux VM 上创建开发基础结构

    若要将应用程序开发的生成和测试阶段自动化,可以使用持续集成和部署 (CI/CD) 管道. 本教程介绍如何在 Azure VM 上创建 CI/CD 管道,包括如何: 创建 Jenkins VM 安装并配 ...

随机推荐

  1. Oracle create tablespace 创建表空间语法详解

    CREATE [UNDO]  TABLESPACE tablespace_name          [DATAFILE datefile_spec1 [,datefile_spec2] ...... ...

  2. 洛谷P4053 [JSOI2007]建筑抢修

    放题解 题目传送门 放代码 #include <bits/stdc++.h>//万能头 #define MAXN 150000//最多的建筑数量(数据范围) using namespace ...

  3. 设置ssh key后push为什么还要输入用户名和密码

    $ git push Username for 'https://github.com': Password for 'https://Username@github.com': Counting o ...

  4. 如何在Drupal7中用代码批量创建节点、评论和分类

    最近,我忙于一个网站迁移工作.网站是使用某个老式CMS建立的,有一定数量的文章.不同的分类数据和用户评论.我的团队被雇来把这些数据从这个浪费人力物力的老式CMS上完整的迁移到功能更现代的开源Drupa ...

  5. 几个简单易懂的排序算法php

    几个简单易懂的排序算法.排序算法,在应用到解决实际问题的时候(由于不一定总是数字排序),重点要分析出什么时候该交换位置. <?php // 冒泡排序 function bubble_sort(a ...

  6. 感言&2

    我写下这些,不是为了向谁诉说我的苦难,我家庭的苦难,而只是想说,朋友,当你们能够坐在星巴克里点杯咖啡打开Macbook刷知乎,思考“人为什么努力”这样的问题时有无数个像我一样出身的孩子在拼命,不因为什 ...

  7. MySQL主从报错1594

    一.主从报错 Relay log read failure 问题原因,MySQL主从使用的是kvm虚拟机,物理机超分严重,在负载高的情况下会kill掉占用资源最多的虚拟机,再启动后导致主从失败 mys ...

  8. CSS快速入门-前端布局1(抽屉)

    一.效果图 前面对CSS基础知识有了一定的了解,是时候开始实战了!以下我对抽屉(https://dig.chouti.com/)主页进行模拟布局. 官方网站效果图: 模拟网站图: 二.实现步骤 1.整 ...

  9. stl源码剖析 详细学习笔记deque(2)

    //---------------------------15/3/13---------------------------- self&operator++() { ++cur; if(c ...

  10. C#调用python文件执行

    我的电脑环境是使用.net framework4.5.1,如果在调试过程中调不通请注意 我用的是Visual studion 2017,python组件下载地址:http://ironpython.c ...