title: Exposing docker container ports not working
body: <p>I am having trouble exposing a port from a docker container to my server.
  Here is what I've done:</p>
  
  <p>I wrote a very simple spring boot app that runs on port 8080.<br>
  Now I am trying to deploy it into a docker container on my server.
  Based on the <a href="https://spring.io/guides/gs/spring-boot-docker/#_containerize_it" rel="nofollow noreferrer">Spring - Getting started with Docker</a> Userguide I've created the following Dockerfile:</p>
  
  <pre><code>FROM openjdk:8-jdk-alpine
  VOLUME /tmp
  ARG JAR_FILE
  COPY ${JAR_FILE} app.jar
  ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
  </code></pre>
  
  <p>In a second step I copied my jar to the same directory (where the dockerfile is stored) and built the container with the following command: </p>
  
  <pre><code>docker build . -t testportmapping --build-arg JAR_FILE=swagger-v2-person-ws-0.0.1-SNAPSHOT.jar
  </code></pre>
  
  <p>Now when I run:</p>
  
  <pre><code>docker run -d testportmapping:latest -p 9065:8080
  </code></pre>
  
  <p>The command runs without an error. But if I take a look at: <code>docker container ls</code>: I see that no portmapping was created:</p>
  
  <pre><code>CONTAINER ID        IMAGE                    COMMAND                  CREATED               STATUS              PORTS                 NAMES
  f15639c81903        testportmapping:latest   "java -Djava.securit…"   About 6 minutes ago   Up 6 minutes                              mystifying_payne
  </code></pre>
  
  <p><strong>Does anyone know that I am doing wrong?</strong></p>
  
  <h3>What I've tried so far:</h3>
  
  <ol>
  <li>Using different local port</li>
  <li>Adding an EXPOSE to the Dockerfile</li>
  <li>Addinng <code>--net=host</code> to the <code>docker run</code> command</li>
  <li>Running the container attached to see if the app starts up correctly (it does)</li>
  </ol>
  
  <h3>My setup:</h3>
  
  <pre><code>root@jupiter /h/n/d/p/swagger-v2# docker version
  Client:
   Version:           18.06.1-ce
   API version:       1.38
   Go version:        go1.10.3
   Git commit:        e68fc7a
   Built:             Tue Aug 21 17:24:56 2018
   OS/Arch:           linux/amd64
   Experimental:      false
  
  Server:
    Engine:
    Version:          18.06.1-ce
    API version:      1.38 (minimum version 1.12)
    Go version:       go1.10.3
    Git commit:       e68fc7a
    Built:            Tue Aug 21 17:23:21 2018
    OS/Arch:          linux/amd64
    Experimental:     false
  
  
  root@jupiter /h/n/d/p/swagger-v2# lsb_release -a
  No LSB modules are available.
  Distributor ID: Ubuntu
  Description:    Ubuntu 16.04.5 LTS
  Release:        16.04
  Codename:       xenial
  </code></pre>