第二章docker安裝配置

Docker架構



Docker安裝配置
    docker官方文檔說要求Linux kernel至少3.8以上,一般爲Centos7或者Ubuntu系統,
    官方文檔https://docs.docker.com/engine/installation/linux/docker-ce/centos/
#卸載舊docker
yum remove docker docker-common docker-selinux docker-engine
#關閉安全機制firewalld
systemctl stop firewalld.service
#關閉firewalld開機啓動
systemctl disable firewalld.service
#查看firewalld狀態
firewall-cmd --state
#開機啓動docker
systemctl enable docker
#安裝docker依賴
yum install -y yum-utils device-mapper-persistent-data lvm2 ntp bridge-utils net-tools openssl openssl-devel
#創建yum源yum-config-manager
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
#同步系統時間
ntpdate pool.ntp.org
#開機啓動時間同步
systemctl enable ntpd.service
#啓用和關閉docker存儲庫
yum-config-manager --enable docker-ce-edge
yum-config-manager --enable docker-ce-test
yum-config-manager --disable docker-ce-edge
#安裝docker
yum -y install docker-ce
#啓動docker服務
systemctl start docker


#更改內核參數
vim /etc/sysctl.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-arptables = 1
sysctl -p

#添加加速器
vim /etc/docker/daemon.json
{
 "registry-mirrors": [
    "https://2wg1slse.mirror.aliyuncs.com",
    "http://4fe32ada.m.daocloud.io"
 ]
}
注:Docker的鏡像以及一些數據都是在/var/lib/docker目錄下


Docker daemon運行在Docker host上,負責創建、運行、監控容器、構建、存儲鏡像
默認Docker daemon只能響應來自本地Host的客戶端請求;如果要允許遠程客戶端請求,需要在配置文件中打開TCP監聽
編輯/etc/systemd/system/multi-user.target.wants/docker.service,在環境變量ExecStart後面添加-H tcp://0.0.0.0允許來自任意IP的客戶端連接
systemctl daemon-reload
systemctl restart docker.service

圖片.png

圖片.png

圖片.png

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章