Docker 简介
Docker 简介 Docker 有一个守护程序,一直监听在套接字之上。 使用镜像的流程 从远程 registry 下载镜像,下载到本地后存储到 image 仓库中。然后通过后台的 libcontainer 引擎将镜像加载到容器中。 Docker 付费版和社区版 Docker-ee 是付费版,Docker-ce 是社区版,并且是免费版。 Docker 组成 Docker daemon 运行的守护进程 Docker client 客户端的运行 Docker registries 镜像仓库,最著名的有 Docker 官方的镜像仓库,但是本地用户也可以创建一个本地的镜像仓库。 镜像和容器的关系 镜像是静态的,容器是动态的,并且有生命周期。要想运行容器 Docker 的资源对象 images 镜像,支持增删改查 containers 容器,支持增删改查 networks 网络,单独支持增删改查 volumes 卷,增删改查 plugins 插件,增删改查 Docker 的安装 找到阿里云源或者是清华大学源,都会有 docker 的 yum 源 daemon.json 文件配置 https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file 官方网址 { "authorization-plugins": [], "data-root": "", "dns": [], "dns-opts": [], "dns-search": [], "exec-opts": [], "exec-root": "", "experimental": false, "features": {}, "storage-driver": "", "storage-opts": [], "labels": [], "live-restore": true, "log-driver": "json-file", "log-opts": { "max-size": "10m", "max-file":"5", "labels": "somelabel", "env": "os,customer" }, "mtu": 0, "pidfile": "", "cluster-store": "", "cluster-store-opts": {}, "cluster-advertise": "", "max-concurrent-downloads": 3, "max-concurrent-uploads": 5, "default-shm-size": "64M", "shutdown-timeout": 15, "debug": true, "hosts": [], "log-level": "", "tls": true, "tlsverify": true, "tlscacert": "", "tlscert": "", "tlskey": "", "swarm-default-advertise-addr": "", "api-cors-header": "", "selinux-enabled": false, "userns-remap": "", "group": "", "cgroup-parent": "", "default-ulimits": { "nofile": { "Name": "nofile", "Hard": 64000, "Soft": 64000 } }, "init": false, "init-path": "/usr/libexec/docker-init", "ipv6": false, "iptables": false, "ip-forward": false, "ip-masq": false, "userland-proxy": false, "userland-proxy-path": "/usr/libexec/docker-proxy", "ip": "0.0.0.0", "bridge": "", "bip": "", "fixed-cidr": "", "fixed-cidr-v6": "", "default-gateway": "", "default-gateway-v6": "", "icc": false, "raw-logs": false, "allow-nondistributable-artifacts": [], "registry-mirrors": [], "seccomp-profile": "", "insecure-registries": [], "no-new-privileges": false, "default-runtime": "runc", "oom-score-adjust": -500, "node-generic-resources": ["NVIDIA-GPU=UUID1", "NVIDIA-GPU=UUID2"], "runtimes": { "cc-runtime": { "path": "/usr/bin/cc-runtime" }, "custom": { "path": "/usr/local/bin/my-runc-replacement", "runtimeArgs": [ "--debug" ] } }, "default-address-pools":[ {"base":"172.80.0.0/16","size":24}, {"base":"172.90.0.0/16","size":24} ] } 指定 docker 版本下载 查看所有版本 [root@centos7_10 ~]# yum list docker-ce.x86_64 --showduplicates 指定下载 apt-get -y install docker-ce=5:18.09.9~3-0~ubuntu-bionic docker-ce-cli=5:18.09.9~3-0~ubuntu-bionic Docker 的进程 dockerd:服务器程序,被 client 直接访问,其父进程为宿主机的 systemd 守护进程 docker-proxy:每个进程 docker-proxy 实现对应一个需要网络通信的容器,管理宿主机和容器的之间端口映射,其父进程 dockerd,如果容器不需要网络则无需启动 containerd:被 dockerd 进程调用以实现与 runc 交互 containerd-shim:真正运行容器的载体,每个容器对应一个 container-shim 进程,其父进程为 containerd Docker 安装源配置 进入网站,下载 repo 源,然后将 repo 源中的源连接替换到repo 源中https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/ ...