您好,登录后才能下订单哦!
密码登录
            
            
            
            
        登录注册
            
            
            
        点击 登录注册 即表示同意《亿速云用户服务条款》
        方法1:用提供的这个conpose文件,将这个文件放到/usr/local/bin

方法2:用epel和extra源中的安装包
1)配置yum源
[root@host1 ~]# cat /etc/yum.repos.d/epel.repo 
[epel]
name=epel
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7Server/x86_64/
enabled=1
gpgcheck=0
2)安装docker-compose
[root@host1 ~]# yum install docker-compose -y
先看一个dyml文件样例
image: redis
image: ubuntu:14.04
image: tutum/influxdb
image: example-registry.com:4000/postgresql
image: a4bc65fd
dns: 8.8.8.8
dns:
 - 8.8.8.8
 - 9.9.9.9dns_search: example.com
dns_search:
 - dc1.example.com
 - dc2.example.comtmpfs:
 - /run
 - /tmpentrypoint:
   - php
   - -d
   - zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so
   - -d
   - memory_limit=-1
   - vendor/bin/phpunit
env_file:
 - ./common.env
 - ./apps/web.env
 - /opt/secrets.env
environment:
RACK_ENV: development
SHOW: 'true'
SESSION_SECRET:environment:
 - RACK_ENV=development
 - SHOW=true
 - SESSION_SECRET
#### 参数17:expose
* 这个标签与Dockerfile中的EXPOSE指令一样,用于指定暴露的端口,但是只是作为一种参考
* 实际上docker-compose.yml的端口映射还得ports这样的标签。
expose:
 external_links:
- redis_1
- project_db_1:mysql
- project_db_1:postgresqlextra_hosts:
- "somehost:162.242.195.82"
- "otherhost:50.31.209.229"labels:
com.example.description: "Accounting webapp"
com.example.department: "Finance"
com.example.label-with-empty-value: ""
labels:
 - "com.example.description=Accounting webapp"
 - "com.example.department=Finance"
 - "com.example.label-with-empty-value"links:
- db
- db:database
- redislogging:
driver: syslog
options:
syslog-address: "tcp://192.168.0.42:123"ports:
- "3000"
- "8000:8000"
- "49100:22"
- "127.0.0.1:8001:8001"security_opt:
 - label:user:USER
 - label:role:ROLEvolumes_from:
 - service_name
 - service_name:ro
 - container:container_name
 - container:container_name:rw
extends:
file: common.yml
 service: webapp
network_mode: "bridge"
network_mode: "host"
network_mode: "none"
network_mode: "service:[service name]"
network_mode: "container:[container name/id]"
services:
some-service:
   networks:
    - some-network
    - other-network
version: '2'
services: 
web:
  build: .
   depends_on:
      - db
     - redis
redis:   
    image: redis
db:   
   image: postgres免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。