title: Docker-compose for mysql, phpmyadmin and nginx
body: <p>I want to use a dockerized SQL database server, an additional client (here: phpmyadmin) and a reverse proxy to make the client interface reachable from outside servers.</p>
  
  <p>So far I used this docker-compose file:</p>
  
  <pre><code>version: '3'
  
  services:
          mariatest:
                  image: mysql
                  restart: always
                  networks:
                         - dbnet
                  environment:
                          MYSQL_ROOT_PASSWORD: password
                          MYSQL_DATABASE: test
                          MYSQL_USER: test
                          MYSQL_PASSWORD: test
  
          phpmatest:
                  depends_on:
                          - mariatest
                  image: phpmyadmin/phpmyadmin
                  restart: always
                  networks:
                          - dbnet
                  ports:
                          - "9080:80"
                  environment:
                          MYSQL_ROOT_PASSWORD: password
                          PMA_HOST: mariatest
  
          reverse:
                  image: nginx
                  networks:
                          - dbnet
                  ports:
                          - "8000:80"
                  volumes:
                          - /var/dockervolumes/nginx:/etc/nginx
  
  networks:
       dbnet:
  </code></pre>
  
  <p>The taken from the volume I get the nginx default.conf file as</p>
  
  <pre><code>server {
      listen       80;
      server_name  localhost;
  
      location / {
          proxy_set_header X-Real-IP  $remote_addr;
          proxy_set_header X-Forwarded-For $remote_addr;
          proxy_set_header Host $host;
          proxy_pass http://localhost:9080/;
      }
  
      #error_page  404              /404.html;
  
      # redirect server error pages to the static page /50x.html
      #
      error_page   500 502 503 504  /50x.html;
      location = /50x.html {
          root   /usr/share/nginx/html;
      }
  }
  </code></pre>
  
  <p>When using the local machine with <a href="http://localhost:9080" rel="nofollow noreferrer">http://localhost:9080</a> I can use the PMA without any problems. When trying to use the reverse proxy address (<a href="http://localhost:8000" rel="nofollow noreferrer">http://localhost:8000</a>) I only get an nginx error the page I am looking for is unavailable. Inside the logs I see that the reverse proxy fails on the connect() with connection refused.</p>
  
  <p>What am I missing for such setups?</p>