docker run -p 127.0.0.1:8080:8080 your_image_name
但我想限制對本地子網的訪問,例如127.0.0.*
.我是否必須為此設定 iptables 過濾器?
PS 有一些具有特定連接埠的容器仍然需要存取外部互聯網:
mycontainer:
image: myimage:latest
container_name: mycontainer
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- WEBUI_PORT=8080
volumes:
- <>:/config
- <>:/downloads
ports:
- 8080:8080 # < need to restrict to local subnet
- 50016:50016
- 50016:50016/udp # <---- still needs outside access!
restart: unless-stopped