Hi, I'm back again!
In a docker compose project i've the following configuration (copying only the rilevant part):
services:
plcsiemens:
profiles:
- host-siemens
build:
context: ./PLCsiemens
dockerfile: Dockerfile
container_name: ${PLCSIEMENS_CONTAINER_NAME:-plcsiemens}
environment:
PLCSIEMENS_PORT: ${PLCSIEMENS_PORT:-102}
PLCOMRON_ADDRESS: ${PLCOMRON_ADDRESS:-192.168.3.1}
PLCOMRON_PORT: ${PLCOMRON_PORT:-9600}
PROCESSING_FAILURE_RATE: ${PROCESSING_FAILURE_RATE:-0.15}
QUALITY_ASSURANCE_FAILURE_RATE: ${QUALITY_ASSURANCE_FAILURE_RATE:-0.18}
DISCARDING_OR_SENDING_FAILURE_RATE: ${DISCARDING_OR_SENDING_FAILURE_RATE:-0.11}
DEFECT_RATE: ${DEFECT_RATE:-0.24}
MEMORY_AREA_SIZE: ${MEMORY_AREA_SIZE:-8}
DATA_BLOCK_NUMBER: ${DATA_BLOCK_NUMBER:-5}
ZITI_PLCSIEMENS_TUNNELER_ADDRESS: ${ZITI_PLCSIEMENS_TUNNELER_ADDRESS:-172.19.0.3}
SLEEP_TIME: ${SLEEP_TIME:-0.95}
networks:
testnet:
ipv4_address: ${PLCSIEMENS_ADDRESS:-172.19.1.1}
command: ["python3", "PLCsiemens.py"]
hmisiemens:
profiles:
- client-siemens
build:
context: ./HMIsiemens
dockerfile: Dockerfile
stdin_open: true
tty: true
depends_on:
ziti-hmisiemens-router:
condition: service_healthy
environment:
PLCSIEMENS_ADDRESS: ${PLCSIEMENS_ADDRESS:-10.11.12.13}
PLCSIEMENS_PORT: ${PLCSIEMENS_PORT:-102}
PLCSIEMENS_RACK: ${PLCSIEMENS_RACK:-0}
PLCSIEMENS_SLOT: ${PLCSIEMENS_SLOT:-1}
container_name: ${HMISIEMENS_CONTAINER_NAME:-hmisiemens}
network_mode: service:ziti-hmisiemens-router
command: ["python3", "HMIsiemens.py"]
ziti-plcsiemens-tunneler:
profiles:
- host-siemens
image: openziti/ziti-host
container_name: ziti-plcsiemens-tunneler
networks:
testnet:
ipv4_address: ${ZITI_PLCSIEMENS_TUNNELER_ADDRESS:-172.19.0.3}
volumes:
- ziti-plcsiemens-tunneler:/ziti-edge-tunnel
environment:
- ZITI_ENROLL_TOKEN
ziti-hmisiemens-router:
profiles:
- client-siemens
image: openziti/ziti-router:1.1.9
container_name: ziti-hmisiemens-router
expose:
- 3022
networks:
testnet:
ipv4_address: ${HMI_SIEMENS_ADDRESS:-172.19.1.2}
environment:
ZITI_CTRL_ADVERTISED_ADDRESS: ziti-controller
ZITI_ENROLL_TOKEN:
ZITI_ROUTER_MODE: tproxy
volumes:
- ziti-hmisiemens-router:/ziti-router
dns:
- 127.0.0.1
- 1.1.1.1
user: root
cap_add:
- NET_ADMIN
healthcheck:
test:
- CMD
- ziti
- agent
- stats
interval: 3s
timeout: 3s
retries: 5
start_period: 30s
I need PLCsiemens
container to be client (so with his own intercept.v1
tunneler) of a new service called PLComron
(with his own host.v1
tunneler). The problem is: in docker networking, containers cannot have multiple network interfaces in the same network. How can I reach the goal?
My idea was to use a second subnet only for this purpose and make PLCsiemens
to be part of both, but for the sidecar configuration I need network_mode: service:ziti-router-sidecar
and that's not feasible to be on two networks. How can I configure a classic tunneler?
Thanks for the help!