docker換源以及拉取鏡像


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 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM