How to restrict linuxserver/code-server to be only accessible via docker openvpn service?

Hello together,
i want to use code server only via vpn connection. so it should not be accessible without a vpn connection. maybe someone can help me? i am new to docker and try to fiddle around with it :smiley:

current status:
the vpn works fine
port 8443 is reachable via the public ip (i do not want this to happen)
the only accessible way should be through the vpn.
when connected to the vpn: i still can only access it via public ip. <- this needs to be fixed somehow

i also tried to block the connection with ufw but encountered some weird issues so i decided to fix it on the docker level (if thats possible?)

docker-compose up -d

docker-compose.yml

version: β€œ2.1”
services:
code-server:
image: linuxserver/code-server
container_name: code-server
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Berlin
- PASSWORD=password #optional
- SUDO_PASSWORD=password #optional
- PROXY_DOMAIN=domain.tld #optional
volumes:
- ./code-server-config:/config
ports:
- 8443:8443
restart: unless-stopped
openvpn:
cap_add:
- NET_ADMIN
image: kylemanna/openvpn
container_name: openvpn
ports:
- β€œ1194:1194/udp”
restart: always
volumes:
- ./vpn-config:/etc/openvpn

Don’t forward/open port 8443 on your firewall