Skip to main content

linux docker环境安装

安装必要的系统工具

yun install -y yum-utils device-mapper-persistent-data lvm2

添加软件资源

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-re.repo

更新yum缓存

yum makecache fast

安装docker

yum -y install docker-ce

配置国内镜像源

curl -sSL http://oyhlcogl9.bkt.clouddn.com/setmirror.sh | sh -s <镜像加速地址>
# 例如:
curl -sSL http://oyhlcogl9.bkt.clouddn.com/setmirror.sh | sh-s http://dockerhub.azk8s.cn
# Azure
# https://github.com/Azure/container-service-for-azure-china/blob/master/aks/README. md#22-container-registry-proxy

启动docker

systemctl start docker

运行docker命令

docker ps
docker version

安装docker compose

curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname-s)-s(uname -m)" -o /usr/local/bin/docker-compose

docker compose可执行权限

chmod -x /usr/local/bin/docker-compose