Docker inside Docker based on Alpine Linux

Source: Internet
Author: User
Tags connection reset docker run

Study from

HTTPS://hub.docker.com/_/docker/

Feeling a word these people really cow B.

Simple test

Pull Mirror

Docker Pull Docker:dind

Run mirror

Docker run-it--privileged--name dind-d docker:dind

View image

[email protected] ~]# Docker exec-it some-Docker SH/# docker Versionclient:version:18.05.0-CE API version:1.37Go version:go1.9.2Git commit:f150324 built:wed May9  A: One: in 2018OS/arch:linux/AMD64 Experimental:falseOrchestrator:swarmServer:Engine:Version:18.05.0-CE API version:1.37(Minimum version1.12) Go version:go1.10.1Git commit:f150324 built:wed May9  A: -: the 2018OS/arch:linux/AMD64 Experimental:false/ #

In fact, you can also view the version information of this machine

vi/etc/os-release NAME="Alpine Linux"ID=alpineversion_id= 3.7. 0 pretty_name="Alpine Linux v3.7"home_url="http ://alpinelinux.org"bug_report_url="http://bugs.alpinelinux.org "

There's a full dockerfile file on GitHub. I've been using CentOS for half a day.

HTTPS://github.com/docker-library/docker/blob/9ecb1c3a6bd766b69eb1858ef721f62fbd930a2b/18.06-rc/ Dind/dockerfile

Content is

From Docker:18.06-rc# https://github.com/docker/docker/blob/master/project/packagers.md#runtime-dependenciesRUNSet-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 ZFSifIt'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 and not for  ThisArchifzfs="$ (apk info--no-cache--quiet ZFS)"&& [-N"$ZFS" ]; Then apk add--no-cache ZFS; fi# TODO Aufs-tools#SetUp Subuid/subgid so"--userns-remap=default"Works out-of-the-BoxrunSet-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/dindENV dind_commit 52379fa76dee07ca038624d639d9e14f4fb719ffrunSet-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-depscopy Dockerd-entrypoint.sh/usr/local/bin/VOLUME/var/lib/Dockerexpose2375entrypoint ["dockerd-entrypoint.sh"]cmd []

Dockerfile with the Docker part installed

From Alpine:3.7RUN apk Add--no-Cache CA-certificates#SetUp nsswitch.conf forGo'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.confrun [! -E/ETC/NSSWITCH.CONF] && Echo'hosts:files DNS'>/etc/nsswitch.confenv docker_channel testenv docker_version18.06.0-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 asOf .- .- -though) RUNSet-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:443) # Wget:error getting response:connection Reset by peer apk add--no-cache--Virtual. fetch-Deps Curl Tar; #  This " Case"Statement isGenerated via"update.sh"Apkarch="$ (apk--print-arch)";  Case "$apkArch" inchx86_64) Dockerarch='x86_64' ;; ARMHF) Dockerarch='Armel' ;; AARCH64) Dockerarch='aarch64' ;; Ppc64le) Dockerarch='Ppc64le' ;; S390X) Dockerarch='s390x' ;; *) echo >&2 "error:unsupported Architecture ($apkArch)"; Exit1 ;;         Esac if! Curl-fl-o docker.tgz"https://download.docker.com/linux/static/${docker_channel}/${dockerarch}/docker-${docker_version}.tgz"; then echo>&2 "error:failed to download ' docker-${docker_version} ' from ' ${docker_channel} ' for ' ${dockerarch} '"; Exit1;         Fi Tar--Extract--file Docker.tgz--strip-components1         --directory/usr/local/bin/     ;         RM docker.tgz; APK del. Fetch-Deps; Dockerd-v; Docker-vcopy modprobe.sh/usr/local/bin/Modprobecopy Docker-entrypoint.sh/usr/local/bin/entrypoint ["docker-entrypoint.sh"]cmd ["SH"]

Docker inside Docker based on Alpine Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.