Hello,
I have created a used defined bridge networK :
docker network create -d bridge --subnet 10.2.0.0/24 --gateway 10.2.0.1 docker_dev_tool_bridge
I have 2 containers: mongodb
and source-analysis
mongodb container:
docker run \
--name ${CONTAINER_NAME} \
-it \
-d \
-v /var/lib/mongo:/data/db \
--network docker_dev_tool_bridge \
--ip 10.2.0.99 \
--cpus=${CPU} \
-m=${MEMORY} \
-e AUTH=no \
--rm \
mongo:3.6-jessie
source-analysis
docker command:
docker run \
--name ${CONTAINER_NAME} \
-it \
-d \
--network docker_dev_tool_bridge \
-p 9002:9002 \
--ip 10.2.0.100 \
-v ~/.m2:/root/.m2 \
-v ${HOST_LOG_DIR}:/var/log \
--env-file stash.info \
--cpus=${CPU} \
-m=${MEMORY} \
source_analysis_runner:0.1.0
But when I execute the curl below, I get:
curl "http://10.2.0.1:9002/v1/codeStats/overall"
(7) Failed to connect to 10.2.0.1 port 9002: Connection refused
System:
Linux AWS
Docker version 17.06.2-ce, build 3dfb8343b139d6342acfd9975d7f1068b5b1c3d3
I have executed the command:
sysctl net.ipv4.conf.all.forwarding=1
and sudo iptables -P FORWARD ACCEPT
on the server and restarted docker
service.
Question:
I would like communication back n forth between the container and host. How do I do that?
Thank you in advance for your help.
NOTE: The containers can talk to each other just fine.