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
Only you can control your future
You're not alone. You still have family,peopel who care for you and want to save you.