分类

链接

2022 年 3 月
 123456
78910111213
14151617181920
21222324252627
28293031  

近期文章

热门标签

新人福利,免费薅羊毛

现在位置:    首页 > Docker > 正文
共享办公室出租
安装docker-compose(国内高速镜像)
Docker 暂无评论 阅读(774)

安装docker-compose(国内高速镜像)
gihub上下载docker-compose太慢了,下载不动,只能换成国内镜像(daocloud.io)来下载。

下载

for docker(1.13.xx)

curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

for docker-ce(17+)

curl -L https://get.daocloud.io/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

for docker-ce(20+)

#curl -L "https://get.daocloud.io/docker/compose/releases/download/v2.2.3/docker-compose-$(uname -s)-$(uname -m)" > /usr/local/bin/docker-compose

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

 

文件大小大概40M+,如果不对,或者报错,请使用:

https://blog.peos.cn/wp-content/uploads/2022/03/docker-compose-linux-x86_64_v2.1.6.zip

或:

https://blog.peos.cn/wp-content/uploads/docker-compose-linux-x86_64_v2.1.6

 

 

下载 完成后:

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

docker-compose --version

 

 

相关资源:

docker-compose: docker-compose集成环境系列 (gitee.com)

 

DOCKER国内镜像

创建或修改 /etc/docker/daemon.json 文件,修改为如下形式

复制代码
{
  "registry-mirrors": [
    "https://registry.docker-cn.com",
    "http://hub-mirror.c.163.com",
    "https://docker.mirrors.ustc.edu.cn"
  ]
}

docker-compose.yml文件示例:

version :'3'
services:
  mysql:
    container_name: mysql
    image: mysql:5.7
    build:
      context:./mysql
    ports:
-"3307:3306"
    volumes:
-./mysql/conf:/etc/mysql/conf.d
-./mysql/logs:/logs
-./mysql/data:/var/lib/mysql
-./mysql/init-sql/:/docker-entrypoint-initdb.d
    command:[
'mysqld',
'--innodb-buffer-pool-size=80M',
'--character-set-server=utf8mb4',
'--collation-server=utf8mb4_unicode_ci',
'--default-time-zone=+8:00',
'--lower-case-table-names=1'
]
    environment:
      MYSQL_DATABASE:'virbac'
      MYSQL_ROOT_PASSWORD:'123456'
    restart: always
  api:
    container_name: api
    image: virbac-api
    build:
      context: virbac-api
      dockerfile:Dockerfile
    ports:
-"8000:8000"
    depends_on:
- mysql
    links:
- mysql:mysql
    restart: always

 

 

linux一键安装docker:

rpm --import http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

curl -fsSL get.docker.com -o get-docker.sh \
&& sudo sh get-docker.sh --mirror Aliyun \
&& sudo systemctl enable docker \
&& sudo systemctl start docker \
&& sudo groupadd -f docker \
&& sudo usermod -aG docker $USER \
&& sudo mkdir -p /etc/docker \
&& sudo newgrp docker \
&& sudo echo -e '{\n "registry-mirrors":["https://9zufkov1.mirror.aliyuncs.com"]\n}'>>/etc/docker/daemon.json \
&& sudo systemctl daemon-reload \
&& sudo systemctl restart docker \
&& sudo svstemctl enable docker

 

 

============ 欢迎各位老板打赏~ ===========

本文版权归Bruce's Blog所有,转载引用请完整注明以下信息:
本文作者:Bruce
本文地址:安装docker-compose(国内高速镜像) | Bruce's Blog

发表评论

留言无头像?