docker-composeA.yml
mysql:
image: mysql
environment:
- XXX=XXX
gogs:
image: gogs/gogs
links:
- mysql:mysql # ok
docker-composeB.yml
tomcat:
image: javaweb:8
links:
- mysql:mysql // wrong, can not find mysql defination
Now I want to link mysql container which defined in docker-composeA.yml, but when I run docker-compose up
with docker-composeB.yml, it said 'mysql is undefined'. So How could I link container cross docker-compose.yml files.
links
and depends_on
both require a reference to a service defined in the same Docker Compose file. You need external_links
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.