1.启动一个centos容器,交互方式,退出就关闭容器(注意以下大部分都都可以省略container)当然,交互方式也可以用完就删除,只需要加上 –rm cid
# docker container run -it f1cb7c7d58b7
# 查看系统版本 cat /etc/redhat-release
# CentOS Linux release 7.6.1810 (Core)

2.查看启动的容器
# docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a3d7cb5c8c7e f1cb7c7d58b7 “/bin/bash” 3 minutes ago Up 3 minutes compassionate_rhodes

Read More →

1. docker 运行测试
docker run learn/tutorial echo "hello word"
由于本地没有此镜像,会执行 docker pull learn/tutorial & docker run learn/tutorial

2.查看现有镜像 docker image ls

REPOSITORY TAG IMAGE ID CREATED SIZE
learn/tutorial latest a7876479f1aa 7 years ago 128MB

3.拉取远程镜像

docker pull debian
docker pull ubuntu:18.04
docker pull centos:7.6.1810

Read More →

1.vmware安装CentOS Linux release 7.9.2009 (Core)

2. 修改为阿里云源

# yum install -y wget
# cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repobak
# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
# yum clean all
# yum makecache

3.安装docker

# step 1: 安装必要的一些系统工具
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
# Step 2: 添加软件源信息
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# Step 3
sudo sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
# Step 4: 更新并安装Docker-CE
sudo yum makecache fast
sudo yum -y install docker-ce
# Step 4: 开启Docker服务
sudo service docker start

4.其他

# docker设置开机启动
systemctl enable docker
# 测试
docker
# 阿里云镜像加速,申请账号后进入以下页面
https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors