docker換源
"""
#1、修改源命令
vim /etc/docker/daemon.json
#2、 添加源
{
"registry-mirrors": [
"https://kfwkfulq.mirror.aliyuncs.com",
"https://2lqq34jg.mirror.aliyuncs.com",
"https://pee6w651.mirror.aliyuncs.com",
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com"
],
"dns": ["8.8.8.8","8.8.4.4"]
}
#3、重啟docker服務
systemctl restart docker
"""
鏡像相關
# 鏡像當成是一個沒有啟動的操作系統
# redis鏡像,mysql鏡像,nginx鏡像,django鏡像,python鏡像:linux+xx軟件----》鏡像跑起來--》容器:操作系統上運行着redis服務
# 查找鏡像網址:https://hub.docker.com/
docker search helloworld
docker search centos
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
centos The official build of CentOS. 5956 [OK] 是否是自動構建
# 獲取鏡像:
docker pull centos # 拉取最新的:相當於docker pull centos:latest
docker pull centos:centos7 # 拉取一個centos7
docker pull centos:centos6.7
docker pull centos:centos10 # 這個 沒有,就報錯
# 查看本地鏡像
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos latest 470671670cac 3 months ago 237MB
centos centos7 5e35e350aded 5 months ago 203MB
# 刪除本地鏡像
docker rmi 470671670cac # 通過id號刪除
docker rmi centos:centos7 # 通過名字刪除
# 刪除所有鏡像
# docker rmi `docker images -q`
相當於刪除后面加一堆id號
docker rmi 470671670cac 5e35e350aded