0
我想在兩個容器之間進行通信,但無法做到這一點。 我在docker compose中添加一個名爲'server'的服務,它依賴於名爲'endpoint'的另一個服務。 我需要通過「端點」到「服務器」的IP和端口,和我做下同Docker撰寫V2網絡錯誤
command: -userver -e endpoint:51393
但現在起,我在主機列表中沒有看到「端點」使用以下命令:
docker-compose exec server cat /etc/hosts
這裏是輸出:
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.21.0.3 49f4808fa677
我的全部泊塢窗,compose.yml文件如下:
version: '2'
services:
endpoint:
build:
context: .
dockerfile: Dockerfile
image: myimage_end:0.1
command: -uendpoint
ports:
- 51393:51393
networks:
- internal
server:
build:
context: .
dockerfile: Dockerfile
image: myimage_server:0.1
command: -userver -e endpoint:51393
ports:
- 51392:51392
depends_on:
- endpoint
networks:
- internal
volumes:
- /local_path/dataset:/dataset
networks:
internal:
driver: bridge
感謝您的信息,我得到它現在已經得到解決。歡呼聲! – ankitkamboj