My docker container does not send traffic over my local vpn on linux

On my host machine (linux ubuntu) I have a vpn configured (using openvpn) but my container created with docker-compose does not send traffic through the vpn. This is my docker-compose, does anyone have any idea how to make the container use the vpn of the host machine?

version: “3.7”
services:
providergroups:
# privileged: true
network_mode: host
restart: always
container_name: providergroups
build: .
environment:
- PORT=8080
- HOST=xyz.cluster-abc.us-east-1.rds.amazonaws.com
- DB_PORT=3306
- DB_SCHEMA=xyz
- DB_USER=userxyz
- DB_PASSWORD=userxyzpassword
ports:
- “8080:8080”


Docker Version:

Client: Docker Engine - Community
Version: 20.10.17
API version: 1.41
Go version: go1.17.11
Git commit: 100c701
Built: Mon Jun 6 23:02:46 2022
OS/Arch: linux/amd64
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 23.0.0
API version: 1.42 (minimum version 1.12)
Go version: go1.19.5
Git commit: d7573ab
Built: Wed Feb 1 17:47:51 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.8
GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0


docker-compose version:

Docker Compose version v2.4.1

Thank you very much for your cooperation

Hi dear @callanor !

Did you find a way to solve this issue? I now facing with the same problem. My wireguard vpn works fine for my browser and other apps, but when it comes to making requests from a container it ignores my wireguard tunnel and always attempts to send queries directly