我有以下docker-compose文件,并且从service
容器中,一个进程正在尝试到达consul
容器。
这种内部容器通讯未发生,请告知。
version: '3'
services:
consul:
image: consul:1.6.1
container_name: consul
ports:
- 8300:8300
- 8400:8400
- 8500:8500
service:
container_name: service
build:
context: ./service
dockerfile: Dockerfile
ports:
- 8080:80
depends_on:
consul
FROM hashicorp/consul-template:alpine as template
COPY nginx.conf.ctmpl /tmp/nginx.conf.ctmpl
# // error on this line, process is stuck there
RUN consul-template -consul-addr "consul:8500" -template="/tmp/nginx.conf.ctmpl:/etc/nginx/conf.d/default.conf"
FROM nginx
COPY --from=template /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
PS 我认为问题在于server
容器正在启动时,它位于默认网络之外,尚未加入网络,因此无法访问{{1 }}容器,问题是,如何解决这个问题?