Can’t open port for my docker container. I started docker by:

docker run -p 8079:8080 -p 50000:50000 -d jenkins

After this i added rule for ufw:

ufw status
Status: active

To                         Action      From
--                         ------      ----
8080                       ALLOW       Anywhere                  
22                         ALLOW       Anywhere                  
80                         ALLOW       Anywhere                  
8079                       ALLOW       Anywhere                  
8079/tcp                   ALLOW       Anywhere                  
8080 (v6)                  ALLOW       Anywhere (v6)             
22 (v6)                    ALLOW       Anywhere (v6)             
80 (v6)                    ALLOW       Anywhere (v6)             
8079 (v6)                  ALLOW       Anywhere (v6)             

8079/tcp                   ALLOW OUT   Anywhere                  
8079/tcp (v6)              ALLOW OUT   Anywhere (v6)  

The result of nmap is:

nmap -sS -O 178.62.88.56

Starting Nmap 7.01 ( https://nmap.org ) at 2017-06-19 11:39 UTC
Nmap scan report for 178.62.88.56
Host is up (0.000035s latency).
Not shown: 998 closed ports
PORT      STATE    SERVICE
22/tcp    open     ssh
50000/tcp filtered ibm-db2
Device type: general purpose
Running: Linux 3.X
OS CPE: cpe:/o:linux:linux_kernel:3
OS details: Linux 3.8 - 3.19
Network Distance: 0 hops

OS detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 5.73 seconds

Also, I tried:

iptables -A INPUT -p tcp --dport 8079 -j ACCEPT

but with no success.

The netstat response is:

netstat -plutn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1514/sshd

tcp6 0 0 :::8079 :::* LISTEN 12802/docker-proxy
tcp6 0 0 :::50000 :::* LISTEN 12781/docker-proxy
tcp6 0 0 :::22 :::* LISTEN 1514/sshd

How can I fix this problem?

5 comments
  • Well, it seems port 50000 is blocked by ufw, since port 8079 is allowed by the fourth ufw rule in your list. I would try a sudo ufw allow 50000.

  • Thank you, but this isn’t the trick… I tried and again with no success/

  • root@ubuntu-512mb-lon1-01:~# wget http://127.0.0.1:8079
    --2017-06-20 07:17:38--  http://127.0.0.1:8079/
    Connecting to 127.0.0.1:8079... connected.
    HTTP request sent, awaiting response... 403 Forbidden
    2017-06-20 07:17:38 ERROR 403: Forbidden.
    
    root@ubuntu-512mb-lon1-01:~# wget http://0.0.0.0:8079
    --2017-06-20 07:18:00--  http://0.0.0.0:8079/
    Connecting to 0.0.0.0:8079... connected.
    HTTP request sent, awaiting response... 403 Forbidden
    2017-06-20 07:18:00 ERROR 403: Forbidden.
    
  • Hey! I wasn’t notified of your reply, sorry :(

    You don’t seem to have a TCP port problem by your last output.

    The 403 Forbidden is generated by your app! It seems a directory permission problem!

  • I have the same problem, cannot open custom port such as 8081 8082 etc

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

i have the same problem its VERY sad nobody can help

Submit an Answer