- 删除已安装的Docker
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
- 配置阿里云Docker Yum源
# Set up repository
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
# Use Aliyun Docker
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
- 安装最新版本
sudo yum install docker-ce
安装指定版本
yum list docker-ce --showduplicates #参看版本
需要指定完整的rpm包的包名,并且加上--setopt=obsoletes=0 参数:
yum install -y --setopt=obsoletes=0 \
docker-ce-17.03.2.ce-1.el7.centos.x86_64 \
docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch
- 镜像加速
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": [
"https://hub-mirror.c.163.com", #网易
"https://mirror.ccs.tencentyun.com",#腾讯
"https://reg-mirror.qiniu.com", #七牛
"https://docker.mirrors.ustc.edu.cn", #科大
"https://dockerhub.azk8s.cn", #Azure 中国镜像
"https://registry.docker-cn.com", #Docker 中国官方镜像
]
}
EOF
- 服务启动
systemctl enable docker
systemctl start docker
- 安装docker-compose
github地址: https://github.com/docker/compose/releases
curl -L "https://get.daocloud.io/docker/compose/releases/download/1.27.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
或
sudo curl -L https://get.daocloud.io/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
问题:
- 引擎无法启动:使加速器格式有问题
{
"registry-mirrors": ["https://hub-mirror.c.163.com"]
}
改成这样
dockerfile 国内 postgresql 源
添加清华源的 postgresql 的 apt 仓库
RELEASE=$(lsb_release -cs)
echo "deb https://mirrors.tuna.tsinghua.edu.cn/postgresql/repos/apt/ ${RELEASE}"-pgdg main | sudo tee /etc/apt/sources.list.d/pgdg.list
导入签名
wget --quiet -O - https://mirrors.tuna.tsinghua.edu.cn/postgresql/repos/apt/ACCC4CF8.asc | sudo apt-key add -
更新仓库,安装 postgresql,这里示例安装版本 11
sudo apt update
sudo apt install postgresql-11