您好,登錄后才能下訂單哦!
方法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.9
dns_search: example.com
dns_search:
?- dc1.example.com
?- dc2.example.com
tmpfs:
?- /run
?- /tmp
entrypoint:
? ?- 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:postgresql
extra_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
- redis
logging:
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:ROLE
volumes_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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。