我正在尝试使用docker swarm开发微服务。我在端口27901上监听了UDP服务器。 我有两种情况:
在情况2中,我不了解该行为,因为可以访问使用相同撰写文件部署的可视化服务。
DOCKERFILE
FROM python:3.6
EXPOSE 27901/udp
RUN mkdir /app
WORKDIR /app
COPY ./code/ /app
DOCKERCOMPOSE
version: "3.7"
services:
data_receiver:
image: data_receiver:latest
deploy:
mode: replicated
replicas: 2
restart_policy:
condition: on-failure
delay: 5s
ports:
- "27901:27901/udp"
visualizer:
image: dockersamples/visualizer:stable
ports:
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
deploy:
placement:
constraints: [node.role == manager]
感谢您的宝贵时间 马雷