I have a docker-compose.yml file along the lines of:
analytics:
build: .
links:
- mongo:mongo
ports:
- 80:80
mongo:
build: docker_containers/mongo
expose:
- 27017
Running docker-compose up
creates a link in /etc/hosts
to the mongo
service. However, running docker-compose run analytics bash
does not create the link -- I checked the /etc/hosts
file.
The docs of docker-compose do not mention anything about this, so I'm confused.
run
? My take on the answers:
我只回答问题编号2.使用docker-compose run
启动整个环境,然后在分析容器中执行docker exec
docker exec -ti $analytics_container_id bash
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.