Closed
Description
I am trying to use the bridged network d_backend
to communicate between nc
listening on the host service and a docker container emitting messages.
This is the network
$ sudo docker network ls
NETWORK ID NAME DRIVER SCOPE
fdc454526116 d_backend bridge local
$ sudo docker network inspect d_backend --format='{{( index .IPAM.Config 0).Gateway}}'
172.22.0.1
On the host I bind nc to that ip:
nc 172.22.0.1 2323 -lk
This is my docker-compose.yml
version: '3.5'
services:
dockerhost:
image: qoomon/docker-host
cap_add:
- NET_ADMIN
- NET_RAW
restart: on-failure
networks:
- backend
tcp_message_emitter:
image: alpine
depends_on:
- dockerhost
command: [ "sh", "-c", "while :; do date; sleep 1; done | nc 'dockerhost' 2323 -v"]
networks:
- backend
networks:
backend:
driver: bridge
I run this (within folder d
so that the correct network is used)
/home/foo/d$ sudo docker-compose up
Starting d_dockerhost_1 ... done
Starting d_tcp_message_emitter_1 ... done
Attaching to d_dockerhost_1, d_tcp_message_emitter_1
dockerhost_1 | Docker Host: 172.22.0.1 (default gateway)
I would expect to see a date on the host every second, but I don't. Any ideas?
Metadata
Metadata
Assignees
Labels
No labels