在 Wireguard 容器后面访问 Docker 端口绑定的容器
Access Docker Container with Port Binding behind Wireguard Container
短篇小说,我没有来自我的互联网提供商的静态 IP,然后我想到了使用 Raspberry Pi 建立我自己的 VPN 服务器的想法 ui 4,Raspbian & linuxserver.io wireguard 图片。然后,在那些 VPN 后面是 Nextcloud 脚本。到目前为止,我已经使用 docker-compose.yaml 完成了此操作,但返回错误:
version: '3.7'
services:
wireguard:
privileged: true
image: ghcr.io/linuxserver/wireguard
container_name: wireguard
restart: unless-stopped
networks:
- backbone
volumes:
- './wireguard/config:/config'
- '/lib/modules:/lib/modules'
environment:
- PUID=1000
- PGID=1000
cap_add:
- NET_ADMIN
- SYS_MODULE
sysctls:
- net.ipv4.conf.all.src_valid_mark=1
- net.ipv6.conf.all.disable_ipv6=0
nextcloud:
privileged: true
depends_on:
- wireguard
image: ghcr.io/linuxserver/nextcloud
container_name: nextcloud
network_mode: service:wireguard
restart: unless-stopped
environment:
- PUID=1000
- PGID=1000
volumes:
- ./nextcloud/config:/config
- ./nextcloud/data:/data
ports:
- 8080:80
networks:
backbone:
driver: bridge
我希望当我访问 http://my.vpn.ip:8080
时,可以使用我的 VPN IP 地址从外部访问我的 nextcloud 网站 ui
我将 network_mode: service:wireguard
行添加到我的 docker-compose.yaml 文件中,这样 nextcloud 容器将与 wireguard 容器位于同一网络中。但它似乎不适用于我已经设置的公开端口 8080:80。当我启动 docker-compose up -d
时,它返回了这样的错误输出:
ERROR: for nextcloud Cannot create container for service nextcloud: conflicting options: port publishing and the container type network mode
ERROR: Encountered errors while bringing up the project.
如果有人能帮助我,我将不胜感激。谢谢。
你必须根据 nextcloud 镜像的标准端口在 wireguard 容器上设置端口转发。在这种情况下 8080:80 和 443:443。一个例子:
version: '3.7'
services:
wireguard:
privileged: true
image: ghcr.io/linuxserver/wireguard
container_name: wireguard
restart: unless-stopped
networks:
- backbone
volumes:
- './wireguard/config:/config'
- '/lib/modules:/lib/modules'
environment:
- PUID=1000
- PGID=1000
cap_add:
- NET_ADMIN
- SYS_MODULE
ports:
- 8080:80 #nextcloud https webgui
- 443:443 #nextcloud http webgui
sysctls:
- net.ipv4.conf.all.src_valid_mark=1
- net.ipv6.conf.all.disable_ipv6=0
nextcloud:
privileged: true
depends_on:
- wireguard
image: ghcr.io/linuxserver/nextcloud
container_name: nextcloud
network_mode: service:wireguard
restart: unless-stopped
environment:
- PUID=1000
- PGID=1000
volumes:
- ./nextcloud/config:/config
- ./nextcloud/data:/data
networks:
backbone:
driver: bridge
短篇小说,我没有来自我的互联网提供商的静态 IP,然后我想到了使用 Raspberry Pi 建立我自己的 VPN 服务器的想法 ui 4,Raspbian & linuxserver.io wireguard 图片。然后,在那些 VPN 后面是 Nextcloud 脚本。到目前为止,我已经使用 docker-compose.yaml 完成了此操作,但返回错误:
version: '3.7'
services:
wireguard:
privileged: true
image: ghcr.io/linuxserver/wireguard
container_name: wireguard
restart: unless-stopped
networks:
- backbone
volumes:
- './wireguard/config:/config'
- '/lib/modules:/lib/modules'
environment:
- PUID=1000
- PGID=1000
cap_add:
- NET_ADMIN
- SYS_MODULE
sysctls:
- net.ipv4.conf.all.src_valid_mark=1
- net.ipv6.conf.all.disable_ipv6=0
nextcloud:
privileged: true
depends_on:
- wireguard
image: ghcr.io/linuxserver/nextcloud
container_name: nextcloud
network_mode: service:wireguard
restart: unless-stopped
environment:
- PUID=1000
- PGID=1000
volumes:
- ./nextcloud/config:/config
- ./nextcloud/data:/data
ports:
- 8080:80
networks:
backbone:
driver: bridge
我希望当我访问 http://my.vpn.ip:8080
时,可以使用我的 VPN IP 地址从外部访问我的 nextcloud 网站 ui我将 network_mode: service:wireguard
行添加到我的 docker-compose.yaml 文件中,这样 nextcloud 容器将与 wireguard 容器位于同一网络中。但它似乎不适用于我已经设置的公开端口 8080:80。当我启动 docker-compose up -d
时,它返回了这样的错误输出:
ERROR: for nextcloud Cannot create container for service nextcloud: conflicting options: port publishing and the container type network mode
ERROR: Encountered errors while bringing up the project.
如果有人能帮助我,我将不胜感激。谢谢。
你必须根据 nextcloud 镜像的标准端口在 wireguard 容器上设置端口转发。在这种情况下 8080:80 和 443:443。一个例子:
version: '3.7'
services:
wireguard:
privileged: true
image: ghcr.io/linuxserver/wireguard
container_name: wireguard
restart: unless-stopped
networks:
- backbone
volumes:
- './wireguard/config:/config'
- '/lib/modules:/lib/modules'
environment:
- PUID=1000
- PGID=1000
cap_add:
- NET_ADMIN
- SYS_MODULE
ports:
- 8080:80 #nextcloud https webgui
- 443:443 #nextcloud http webgui
sysctls:
- net.ipv4.conf.all.src_valid_mark=1
- net.ipv6.conf.all.disable_ipv6=0
nextcloud:
privileged: true
depends_on:
- wireguard
image: ghcr.io/linuxserver/nextcloud
container_name: nextcloud
network_mode: service:wireguard
restart: unless-stopped
environment:
- PUID=1000
- PGID=1000
volumes:
- ./nextcloud/config:/config
- ./nextcloud/data:/data
networks:
backbone:
driver: bridge