7

docker-compose修改网络映射信息

 4 years ago
source link: https://www.wencst.com/archives/767
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

docker-compose修改网络映射信息

作者: wencst 分类: docker,linux 发布时间: 2018-11-11 09:33 阅读: 1,516 次

depends_on

用于指定服务依赖,一般是mysql、redis等。
指定了依赖,将会优先于服务创建并启动依赖。

links也可以指定依赖。

external_links

链接搭配docker-compose.yml文件或者Compose之外定义的服务,通常是提供共享或公共服务。格式与links相似:

external_links:
 - redis_1
 - project_db_1:mysql
 - project_db_1:postgresql

注意,external_links链接的服务与当前服务必须是同一个网络环境。

extra_hosts

添加主机名映射。

extra_hosts:
 - "somehost:162.242.195.82"
 - "otherhost:50.31.209.229"

将会在/etc/hosts创建记录:

162.242.195.82  somehost
50.31.209.229   otherhost

如果文章对您有用,扫一下支付宝的红包,不胜感激!

欢迎加入QQ群进行技术交流:656897351(各种技术、招聘、兼职、培训欢迎加入)

Leave a Reply Cancel reply

You must be logged in to post a comment.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK