1、要先安裝docker-ce-selinux-17.03.2.ce,否則安裝docker-ce會報錯(僅阿里雲安裝docker前提)
yum install
2、安裝依賴
3、設定docker源
$sudo yum-config-manager \
--add-repo \
4、啟動edge版 docker.repo源
$sudo yum-config-manager --enable docker-ce-edge
5、安裝docker-ce版
$sudo yum install docker-ce-17.03.2.ce
6、啟動docker
$sudo systemctl start docker
7、設定自動啟動
$systemctl enable docker
8、映象加速配置:
$sudo mkdir -p /etc/docker
$sudo tee /etc/docker/daemon.json <<-'eof'
eofsudo systemctl daemon-reload
sudo systemctl restart docker
9、驗證:執行hello-world
$docker run hello-world
補充:調整docker0的網段方式:
sudo systemctl stop docker
通過命令route -n
檢視docker0是否存在,若存在需先刪除:
sudo ip link del docker0
vi /etc/docker/daemon.json 新增內容 "bip": "ip/netmask" [ 切勿與宿主機同網段 ]
如:docker日誌/垃圾檔案清理:
1、執行docker命令:docker system prune
2、清理日誌:
#!/bin/sh
echo "******************** start clean docker containers logs *************************="
logs=$(find /var/lib/docker/containers/ -name *-json.log)
for log in $logs
doecho "clean logs : $log"
cat /dev/null > $log
done
echo "******************** end clean docker containers logs *************************="
docker rm -f -v $(docker ps -aq)
docker volume rm $(docker volume ls)
rm -rf /var/lib/etcd/
docker配置
vi /etc/docker/daemon.sjon
"bip":"172.21.100.1/24"
,"insecure-registries":["172.16.101.43:5000","172.16.101.49","docker.jieyue.com"]
,"registry-mirrors": ["","",""]
,"log-driver": "json-file"
,"log-opts":
,"max-concurrent-downloads": 10
,"max-concurrent-uploads": 10
,"storage-driver": "overlay2"
,"storage-opts": ["overlay2.override_kernel_check=true"]
}
Docker(一) 快速安裝
uname r檢查核心版本,返回的值大於3.10即可。sudo apt get install docker.io source etc bash completion.d docker.io 然後檢視版本,檢測是否安裝成功 sodu docker.io version這裡也分為二種方式 方法一 推...
docker快速安裝Jenkins
1.pull映象 要使用最新的lts docker pull jenkins jenkins lts 新建容器 docker run name jenkins p 8081 8080 p 50000 50000 d jenkins jenkins lts 備註 8080為docker埠,8081為對...
離線快速安裝docker
sudo yum resolve destdir tmp docker docker ce tar zcvf docker.tar.gz tmp docker scp r docker.tar.gz deploy host 部署的內網伺服器 建立system管理檔案 graph var lib do...