1
votes

I have successfully set up Docker-Desktop for Windows and installed my first linux containers from dockerhub. Network-wise containers can communicate with each other on the docker internal network. I am even able to communication with the host network via host.docker.internal.

Now i am coming to the point where i want to access the outside network (Just some other server on the network of the docker host) from within a docker-container.

I have read on multiple websites that network_mode: host does not seem to work with docker desktop for windows.

I have not configured any switches within Hyper-V Manager and have not added any routes in docker, as i am confused with the overall networking concept of docker-desktop for windows in combination with Hyper-V and Linux Containers.

Below you can see my current docker-compose.yaml with NiFi and Zookeeper installed. NiFi is able to see Zookeeper and NiFi is able to query data from a database installed on the docker host. However i need to query data from a different server other than the host.

version: "3.4"
services:
  zookeeper:
    restart: always
    container_name: zookeeper
    ports: 
      - 2181:2181
    hostname: zookeeper
    image: 'bitnami/zookeeper:latest'
    environment:
      - ALLOW_ANONYMOUS_LOGIN=yes
  nifi:
    restart: always
    container_name: nifi
    image: 'apache/nifi:latest'
    volumes: 
      - D:\Docker\nifi:/data                          # Data directory
    ports:
      - 8080:8080                                     # Unsecured HTTP Web Port
    environment:
      - NIFI_WEB_HTTP_PORT=8080
      - NIFI_CLUSTER_IS_NODE=false
      - NIFI_CLUSTER_NODE_PROTOCOL_PORT=8082
      - NIFI_ZK_CONNECT_STRING=zookeeper:2181
      - NIFI_ELECTION_MAX_WAIT=1 min
    depends_on:
      - zookeeper
1

1 Answers

0
votes

Check if you have connection type in dockerNAT set to appropriate external network and set IPV4 config to auto.