A
A
alexanderqwert2018-10-31 21:45:08
SSH
alexanderqwert, 2018-10-31 21:45:08

Why don't Docker containers send traffic to a port?

The situation is as follows:
it became necessary to access an external service through socks5 (license binding)
, it was decided to create a separate container with shared socks:
in the socks5 docker image


FROM debian:jessie
ADD ssh/ /root/.ssh # added keys
CMD ["ssh", "-C2qTnN", "-D", "1080", "[email protected]_ip"]
EXPOSE 1080

when executed
curl --socks5 127.0.0.1:1080 url
in a socks5 container, everything goes fine
if I execute a command from a php container
curl --socks5 socks5:1080 url, I get
Failed to connect to socks5 port 1080: Connection refused
Although tcpdump port 1080 running in a socks5 container shows that the packets reach!
it came to mind to relay incoming traffic through socat and then everything worked! but I need to do it without a crutch! straight! all containers are on the same network, connected via docker-compose.yml

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Q
qq1, 2018-11-02
@alexanderqwert

Try adding the -g ( tyts ) option, by default ssh binds ports only on the loopback interface and they are not available to other containers. Well, check that the ssh key is without a password and the host is present in known_hosts. This is how it worked for me:

CMD ["ssh", "-C2qTnNg", "-o", "StrictHostKeyChecking no", "-D", "1080", "[email protected]"]

T
Talik, 2018-10-31
@Talik0507

It's not entirely clear, are you accessing the container or from the container?
what are the container launch options?
containers connected?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question