title: docker-compose - Expose linked service port
body: <p>I'm trying to setup a SonarQube container backed by a MySQL database container.
  My docker-compose.yml:</p>
  
  <pre><code>sonar:
    environment:
      - SONARQUBE_USER=sonar
      - SONARQUBE_PASSWORD=sonar
      - SONARQUBE_DATABASE=sonar
      - SONARQUBE_JDBC_URL=jdbc:mysql://db:3306/sonar?useUnicode=true&amp;characterEncoding=utf8
    build: .
    ports:
      - "19000:9000"
      - "19306:3306"
    links:
      - db
  db:
    environment:
      - MYSQL_ROOT_PASSWORD=root-secret
      - MYSQL_USER=sonar
      - MYSQL_PASSWORD=sonar
      - MYSQL_DATABASE=sonar
    image: mysql
  </code></pre>
  
  <p>In the <code>ports</code> section I'm trying to expose both port 9000 from SonarQube (web interface) and port 3306 (MySQL connection).</p>
  
  <p>Is there any way to expose a port from a linked service (such as <code>db</code> in this case) from the "main" container e.g. <code>sonar</code>?</p>
  
  <p>EDIT: Just to better explain my needs, I want to expose both ports to my <code>localhost</code>. I need access to both ports from my machine, as I SonarQube runner needs access to the database and I want to run some queries in the database too, <em>from my machine, not inside another container</em>.</p>