impossib1e
(Impossib1e)
September 23, 2021, 12:02pm
1
Im running docker on a Ubuntu machine , and im trying to solve a problem .
Im actually running 2 containers :
1- a container running tor
2 - a container running ocserv
the task I want to do is , i want to redirect ocserv output traffic through the tor container .
what solution you suggest for this ?
meyay
(Metin Y.)
September 23, 2021, 4:34pm
2
Let me quote the relevant part form the docs:
https://docs.docker.com/engine/reference/run/#network-settings:
Network: container
With the network set to container
a container will share the network stack of another container. The other container’s name must be provided in the format of --network container:<name|id>
. Note that --add-host
--hostname
--dns
--dns-search
--dns-option
and --mac-address
are invalid in container
netmode, and --publish
--publish-all
--expose
are also invalid in container
netmode.
Example running a Redis container with Redis binding to localhost
then running the redis-cli
command and connecting to the Redis server over the localhost
interface.
$ docker run -d --name redis example/redis --bind 127.0.0.1
$ # use the redis container's network stack to access localhost
$ docker run --rm -it --network container:redis example/redis-cli -h 127.0.0.1