1

docker安装

# 安装必要依赖
yum install -y yum-utils device-mapper-persistent-data lvm2

# 配置docker下载源
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

# 安装docker
yum makecache fast \
yum install -y docker-ce

使用docker

# 启动docker 
systemctl start docker

# 设置为开机自动启动
systemctl enable docker

# 查看当前docker版本号
docker --version

docker配置国内镜像

sudo mkdir -p /etc/docker
sudo vim /etc/docker/daemon.json
填入以下配置项

{
    "registry-mirrors": ["https://registry.docker-cn.com"]
}

重启docker
sudo systemctl daemon-reload
sudo systemctl restart docker

安装docker-compose

# 下载 docker-compose 命令
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

# docker-compose 执行权限
sudo chmod +x /usr/local/bin/docker-compose

# 查看当前docker-compose版本号
docker-compose -version
需要容器相关操作和镜像相关操作的话请评论区留言

Felix
73 声望2 粉丝