Docker安装
环境准备
1、liunx基础
2、Contos7.6
3、连接服务器的工具 MobaXterm等
[root@work lib]
3.10.0-957.el7.x86_64
[root@work lib]
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
安装
帮助文档:https://docs.docker.com/engine/install/centos/
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
yum install -y yum-utils
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
yum install docker-ce docker-ce-cli containerd.io
yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
systemctl start docker
docker version
docker run hello-world
docker images
[root@work ~]
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql latest c60d96bd2b77 2 weeks ago 514MB
hello-world latest d1165f221234 5 months ago 13.3kB
卸载docker:
yum remove docker-ce docker-ce-cli containerd.io
rm -rf /var/lib/docker
rm -rf /var/lib/containerd
/var/lib/containerd
阿里云镜像加速器
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://k33mx0l6.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
Docker的常用命令
帮助命令
docker version
docker info
docker 命令 --help
帮助文档地址:https://docs.docker.com/reference/
镜像命令
#显示docker的系统信息,包括镜像和容器的数量
docker 命令 --help #帮助命令
**帮助文档地址:https://docs.docker.com/reference/**
#### 镜像命令
#### 容器命令
|