title: Docker: map exposed ports
body: <p>I have an nginx reverse proxy (jwilder) in order to redirect to different containers with different urls.</p>
  <p>I have two containers with websites:</p>
  <ul>
  <li><strong>ngnix</strong>, with port 80 exposed (working ok)</li>
  <li><strong>ghost blog</strong>, which uses internally the port <strong>2368</strong></li>
  </ul>
  <p>I'm having issues with the ghost one. Without the reverse proxy it was pretty easy, just map the port <strong>80:2368</strong> and it worked like a charm. Now i got a 502 error and i can't access to it.</p>
  <p>This is my current YAML file:</p>
  <pre><code>version: '3.1'
  
  services:
  
    ghost:
      image: ghost:latest
      container_name: ghost_jv
      volumes:
        - ./ghost/content:/var/lib/ghost/content
        # - /home/pete/Documents/containers/ghost/content:/var/lib/ghost/content
      restart: always
  # ports commented since it needs to expose 
  #    ports:
  #      - 80:2368
      expose:
        - 80
  #      - 2368
      environment:
        database__client: mysql
        database__connection__host: db
        database__connection__user: root
        database__connection__password: example
        database__connection__database: ghost
        #url: https://sorullo.petito.com.ar
        VIRTUAL_HOST: sorullo.petito.com.ar
        # should i put a virtual port?
        # VIRTUAL_PORT: 2368
  </code></pre>
  <p>This is my docker ps:</p>
  <pre><code>CONTAINER ID   IMAGE                             COMMAND                  CREATED             STATUS          PORTS                               NAMES
  21dab949b22b   ghost:latest                      &quot;docker-entrypoint.s…&quot;   9 seconds ago       Up 8 seconds    80/tcp, 2368/tcp                    ghost_jv
  65248dc85c9f   arm64v8/mysql                     &quot;docker-entrypoint.s…&quot;   About an hour ago   Up 26 minutes   3306/tcp, 33060/tcp                 db_jv
  998fc6bb4d9f   jwilder/nginx-proxy               &quot;/app/docker-entrypo…&quot;   About an hour ago   Up 2 seconds    0.0.0.0:80-&gt;80/tcp, :::80-&gt;80/tcp   stoic_sanderson
  </code></pre>