i have only been working with Docker for a short time. Currently, I’m trying to create an service with openvpn. To create the service I used docker-compose with version 2.4 (defined in the Yaml).
For routing purposes I want to assign a static-ip to the container. The network is a bridge-network with the following specifications:
- subnet: 172.16.128.0/17
- ip-address: 172.16.128.1
- ip-range: 172.16.128.0/17
- gateway: 172.16.255.254
When I execute the command “ip addr show” in the container by the Dockerfile, it gaves me the ip “172.17.x.x” as output and not the static ip. A ping is also not successfull. But the network is successfully created.
version: "2.4" networks: extern: driver: bridge name: bridge_extern ipam: driver: default config: - subnet: 172.16.128.0/17 ip_range: 172.16.128.0/17 gateway: 172.16.255.254 aux_addresses: openvpn-docker: 172.16.128.1 volumes: openvpn_pki: external: true services: openvpn: build: . image: debian:latest hostname: openvpn-docker container_name: extern_openvpn dns: - 18.104.22.168 cap_add: - NET_ADMIN - NET_RAW ports: - "1194:1194" networks: extern: ipv4_address: 172.16.128.1 volumes: - type: volume source: openvpn_pki target: /etc/openvpn/pki - type: bind source: . target: /media
Do you have an idea and can you please help me?
Thank you and best regards