Docker-proxy get accept4: file descriptor

I am trying to add port forwarding to a docker container using docker-proxy, but experiencing this error below,

Here are the details

  • A container with IP 172.17.0.2 is already running with --net = none. We provide our own network and do not use the docker0 network.

  • Now we want to set some container ports for placement, so we thought about trying a proxy server.

  • we ran the following command:

    $ docker-proxy -container-ip 172.17.0.2 -container-port 8000 -host-ip 0.0.0.0   -host-port 8000 -proto tcp
     and we are getting,
     2017/03/16 10:02:30 Stopping proxy on tcp/[::]:8001 for tcp/172.17.0.2:8001 (accept tcp [::]:8001: accept4: bad file descriptor)
    

Docker version: docker version 17.03.0-ce, build 60ccb22

+4
source share
1 answer

, - , , , , Dockerfile Docker, -p 8000: 8000. Docker, , docker -p roxy, .

, iptables, DOCKER NAT DOCKER . :

iptables -t nat -A DOCKER ! -i your_bridge0 -p tcp -m tcp --dport 8000 -j DNAT --to-destination 172.17.0.2:8000

:

iptables -A DOCKER ! -i your_bridge0 -o your_bridge0 -d 172.17.0.2 -p tcp --m tcp --dport 80 -j ACCEPT

, , , . Docker, , , iptables (ufw, firewalld ..).

0

Source: https://habr.com/ru/post/1672432/


All Articles