title: Unable to run Apache nifi docker container in swarm. Empty response
body: <p>I am unable to run official nifi image in docker swarm.
  When I start container in regular mode:</p>
  
  <pre><code>docker run --name nifi -p 8080:8080 -d apache/nifi:latest
  </code></pre>
  
  <p>everything works fine and I can access the application under <a href="http://localhost:8080/nifi" rel="nofollow noreferrer">http://localhost:8080/nifi</a></p>
  
  <p>However when i try to run application in docker swarm:</p>
  
  <pre><code>docker swarm init
  docker stack deploy -c docker-compose.yml nifi
  </code></pre>
  
  <p>With the following docker-compose.yml</p>
  
  <pre><code>version: "3"
  services:
    zookeeper:
      hostname: zookeeper
      container_name: zookeeper
      image: 'bitnami/zookeeper:latest'
      environment:
        - ALLOW_ANONYMOUS_LOGIN=yes
    nifi:
      image: apache/nifi:latest
      ports:
        - "8080:8080" 
      expose:
        - "8080"
      environment:
        - NIFI_WEB_HTTP_PORT=8080
        - NIFI_WEB_HTTP_HOST=localhost
        - NIFI_CLUSTER_IS_NODE=true
        - NIFI_CLUSTER_NODE_PROTOCOL_PORT=8082
        - NIFI_ZK_CONNECT_STRING=zookeeper:2181
        - NIFI_ELECTION_MAX_WAIT=1 min
  </code></pre>
  
  <p>Application starts (zookeeper and nifi) but is unaccessible under <a href="http://localhost:8080/nifi" rel="nofollow noreferrer">http://localhost:8080/nifi</a></p>
  
  <pre><code>curl http://localhost:8080
  curl: (52) Empty reply from server
  </code></pre>
  
  <p>However running the following code:</p>
  
  <pre><code>docker exec -it 629ecd6949d9 curl -v http://localhost:8080
  </code></pre>
  
  <p>shows that nifi is up and running, but for some reason it does not work from outside container.</p>
  
  <p>I am close to start hitting the wall with my head. How can I fix this?</p>
  
  <p>Best
  Paweł</p>