安装docker

  1. 删除已安装的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

  1. 配置阿里云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


  1. 安装最新版本
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

  1. 镜像加速
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

  1. 服务启动
systemctl enable docker
systemctl start docker

  1. 安装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


问题:

  1. 引擎无法启动:使加速器格式有问题
{
    "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


©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容