title: Docker compose service does not expose ports
body: <p>So I'm building an Elixir/Phoenix application and I've got the following <code>docker-compose</code> service:</p>
  
  <pre><code>dev:
      extends:
        service: common
      environment:
        POSTGRES_HOST: "postgres.dev"
        MIX_ENV: dev
      ports:
        - "4000:4000"
      depends_on:
        - postgres
      command: &gt;
        bash -c '
        cd $$APP_HOME \
        &amp;&amp; mix ecto.create \
        &amp;&amp; mix ecto.migrate \
        &amp;&amp; iex -S mix phx.server'
  </code></pre>
  
  <p>and this effectively runs the app on <code>0.0.0.0:4000</code>:</p>
  
  <pre><code>Erlang/OTP 20 [erts-9.1.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
  
  [info] Running MyApp.Endpoint with Cowboy using http://0.0.0.0:4000
  </code></pre>
  
  <p>Checking with <code>docker ps</code> the ports are not exposed:</p>
  
  <pre><code>CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
  7a1d80cf0511        app_dev         "bash -c ' cd $APP..."   4 minutes ago       Up 4 minutes                                 app_dev_run_2
  ef7bed51cf24        postgres:10.0       "docker-entrypoint..."   16 minutes ago      Up 16 minutes       0.0.0.0:5432-&gt;5432/tcp   app_postgres_1
  </code></pre>
  
  <p>While the Postgres service has the exposed port and I effectively can connect to it via a GUI:</p>
  
  <pre><code>postgres:
      image: postgres:10.0
      ports:
        - "5432:5432"
      networks:
        default:
          aliases:
            - postgres.dev
      restart: always
  </code></pre>
  
  <p>I don't understand why the <code>dev</code> service does not expose the ports when they're the exact same command/definitions but using 4000 instead of 5432.</p>
  
  <p>I've tried stopping, deleting all containers, networks and images but this still persists.</p>
  
  <p>I don't have any <code>EXPOSE</code> commands in my Dockerfile and I'm running the service with <code>docker-compose run dev</code>.</p>
  
  <p>Any help?</p>