title: Container getting connection refused
body: <p>I am having an issue with my docker containers, where one of them is a REST API server and the other is just a test container to curl the former one. </p>
  
  <p>I have created a custom docker network with a specific IP address range and both containers are connected to it.</p>
  
  <p>In the Dockerfile(REST API Server image) I have exposed the port 8090 and also mapped it to the host port 8090 with the <code>-p</code> flag when running a container. I did check on the REST container if the port was exposed by <code>netstat -a</code> but it wasn't. I am not sure what the issue is, as I can't see what I am doing wrong!</p>
  
  <p><strong>Dockerfile for REST API Server</strong></p>
  
  <pre><code>FROM openjdk:8-alpine
  WORKDIR /
  EXPOSE 8090
  COPY target/blockchain-0.0.1-SNAPSHOT.jar blockchain.jar
  CMD java -jar blockchain.jar
  </code></pre>
  
  <p><strong>REST Container Creation</strong></p>
  
  <pre><code>docker container run --rm -p 8090:8090 --ip 172.18.0.3 --net multichain-network --name multichain-app bc59
  </code></pre>
  
  <p><strong>Test Container to run Curl and Response</strong></p>
  
  <pre><code>docker container run --rm -it --net multichain-network --ip 172.18.0.4 byrnedo/alpine-curl http://172.18.0.3:8090/api/blockchain/address/create
  curl: (7) Failed to connect to 172.18.0.3 port 8090: Connection refused
  </code></pre>
  
  <p><strong>Netstat -a Response</strong></p>
  
  <pre><code>$ docker exec multichain-app netstat -a
  Active Internet connections (servers and established)
  Proto Recv-Q Send-Q Local Address           Foreign Address         State       
  tcp        0      0 0.0.0.0:http-alt        0.0.0.0:*               LISTEN      
  tcp        0      0 localhost:41183         0.0.0.0:*               LISTEN      
  udp    34560      0 localhost:34462         0.0.0.0:*                           
  Active UNIX domain sockets (servers and established)
  Proto RefCnt Flags       Type       State         I-Node Path
  unix  2      [ ]         STREAM     CONNECTED     456199
  </code></pre>
  
  <p>I don't understand why port 8090 is not showing up in the <code>netstat</code> command as I have it defined in the Dockerfile and also specify the -p flag. Can someone shed any light on this for me?</p>