Enable incomming connection for docker-compose

IPv4/6, Port, VPN, proxy, SSH, remote access and more.
Locked
User avatar
vadero9784
Posts: 5
Joined: 11 Sep 2022, 05:30

Enable incomming connection for docker-compose

Post by vadero9784 »

Hi, i want start my app with docker compose (i use portainer).
When container started, i try connect from browser but receive strange error: Browser try load page some time, and then raise timeout error.

I simplified issue to current docker-compose (simple echo server):
version: "3"
services:
echo-server:
image: ealen/echo-server
ports:
- 6000:80

On portainer, container started successful, port mapping (6000 host -> 80 container) working
When i connect to ssh to NAS, i see port 6000 as opened (with netstat command)
Try make request with curl (ter_curl of course), and get same timeout error. ter_wget not working too

I try add rule on firewall for allow route, but nothing happened.
Control panel > firewall > add new > specify name, check TCP and UDP, action: allow > incoming IP: all > Port: all (or try 6000 too)
After submit, i lost access to NAS by web ( i can delete wrong rule in SSH session)

What am I doing wrong?)
User avatar
vadero9784
Posts: 5
Joined: 11 Sep 2022, 05:30

Re: Enable incomming connection for docker-compose

Post by vadero9784 »

P.S.
Terramaster f2 423
TOS 5.0.176

Commands to check (running from NAS SSH)
ter_curl http://localhost:6000 <- timeout
ter_curl http://127.0.0.1:6000 <- timeout
And from my browser, go to page <IP>:6000 <- timeout
User avatar
TMzethar
TM Support
Posts: 2827
Joined: 27 Oct 2020, 16:43

Re: Enable incomming connection for docker-compose

Post by TMzethar »

TNAS does not set a firewall by default. The actual effect of the "permit" you set is "prohibit all other IPs or ports except those allowed".
You can try to modify the connection mode of the container (bridge/host).
To contact our team, please send email to following addresses, remember to replace (at) with @:
Technical team: support(at)terra-master.com (for technical support)
Service team: service(at)terra-master.com (for purchasing, return, replacement, RMA service)
User avatar
vadero9784
Posts: 5
Joined: 11 Sep 2022, 05:30

Re: Enable incomming connection for docker-compose

Post by vadero9784 »

TMzethar wrote: 18 Apr 2023, 09:34 TNAS does not set a firewall by default. The actual effect of the "permit" you set is "prohibit all other IPs or ports except those allowed".
You can try to modify the connection mode of the container (bridge/host).
Thanks, it worked.

Network mode host it seems like a bad idea, because usually services listen to the same ports. For example, you may have several containers listening to port 80. Then it will lead to a conflict.

For future: Add network_mode: bridge to your docker-compose file

In my case:
version: "3"
services:
echo-server:
image: ealen/echo-server
ports:
- "6000:80"
network_mode: bridge
Locked

Return to “Network”