| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Docker Image Tags:
Docker image to forward TCP and UDP traffic to the docker host. This also works for (rootless) podman. This README.md uses the term docker, but you can read that as both docker and podman (it works for both), unless otherwise specified.
This container will determine the docker host address in the following order
By default all ports (1-65535) are forwarded to docker host.
Important
You have to bind your host applications to 0.0.0.0 or bridge network gateway in addition to 127.0.0.1.
Use following docker command to get the bridge network gateway IP address
docker network inspect bridge --format='{{( index .IPAM.Config 0).Gateway}}'
For (rootless) podman, it's sufficient to bind to localhost, assuming default podman installation.
You might need to configure your firewall of the host system to allow the docker-host container to communicate with the host on your relevant port, see #21.
You probably need to add nf_nat kernal module to podman machine by running following commands
podman machine ssh
sudo modprobe nf_natThese examples will send messages from docker container to docker host with netcat
Start netcat server TCP on port 2323 to receive and display messages
nc -lk 2323Start netcat server UDP on port 5353 to receive and display messages
nc -lk 5353 -uRun the dockerhost container.
docker run \
--name 'docker-host' \
--cap-add=NET_ADMIN --cap-add=NET_RAW \
--restart on-failure \
-d qoomon/docker-hostRun your application container and link the dockerhost container. The dockerhost will be reachable through the domain/link dockerhost of the dockerhost container
docker run --rm \
--link 'docker-host' \
-it alpine nc 'docker-host' 2323 -vdocker run --rm \
--link 'docker-host' \
-it alpine nc 'docker-host' 5353 -u -vCreate the dockerhost network.
network_name="Network-$RANDOM"
docker network create "$network_name"Run the dockerhost container within the dockerhost network.
docker run --name "${network_name}-docker-host" \
--cap-add=NET_ADMIN --cap-add=NET_RAW \
--restart on-failure \
--net=${network_name} --network-alias 'docker-host' \
qoomon/docker-hostRun your application container within the dockerhost network. The dockerhost will be reachable through the domain/link docker-host of the dockerhost container
docker run --rm \
--link 'docker-host' \
-it alpine nc 'docker-host' 2323 -vdocker run --rm \
--link 'docker-host' \
-it alpine nc 'docker-host' 5353 -u -vversion: '2'
services:
docker-host:
image: qoomon/docker-host
cap_add: [ 'NET_ADMIN', 'NET_RAW' ]
mem_limit: 8M
restart: on-failure
tcp_message_emitter:
depends_on: [ docker-host ]
image: alpine
command: [ "sh", "-c", "while :; do date; sleep 1; done | nc 'docker-host' 2323 -v"]
udp_message_emitter:
depends_on: [ docker-host ]
image: alpine
command: [ "sh", "-c", "while :; do date; sleep 1; done | nc 'docker-host' 5353 -u -v"]| Back | FazBrowse Home | New Git URL |