title: docker compose image no longer working laravel
body: <p>I have a laravel app that I develop locally using docker to create the containers.</p>
  
  <p>This has worked for months, I haven't developed the app for the past 2 months but today when I start the containers I can no longer communicate from the php instance to the database instance.  I can connect to the server using my localhost address on the machine but when I try and do anything on the php container (e.g. user logs in to the app) it comes up with connection refused.</p>
  
  <p>So to  summarise, I can do php artisan migrate from my laptop and tables get created, I then view the site (localhost:8080) and the login screen shows, I then try and login and get the below error:</p>
  
  <blockquote>
    <p>Illuminate \ Database \ QueryException (2002) SQLSTATE[HY000] [2002]
    Connection refused (SQL: select * from <code>users</code> where <code>email</code> =
    test@email.com and <code>users</code>.<code>deleted_at</code> is null limit 1)</p>
  </blockquote>
  
  <p>I have included all my files below</p>
  
  <p><code>.env</code></p>
  
  <pre><code>APP_NAME=Laravel
  APP_ENV=local
  APP_KEY=**REMOVED**
  APP_DEBUG=true
  APP_URL=https://localhost:8443
  APP_CDN=true
  
  LOG_CHANNEL=stack
  
  DB_CONNECTION=mysql
  DB_HOST=127.0.0.1
  DB_PORT=33061
  DB_DATABASE=dockerApp
  DB_USERNAME=root
  DB_PASSWORD=secret
  </code></pre>
  
  <p><code>docker-compose.yml</code></p>
  
  <pre><code>version: '2'
  
  services:
      nginx:
        image: nginx:1.13.12
        ports:
          - "8443:443"
          - "8080:80"
        volumes:
          - ./:/var/www
          - ./nginxconf:/etc/nginx/conf.d
          - ./ssl-cert:/etc/nginx/certs
        working_dir: /var/www
        links:
          - php
      php:
          build:
              context: ./
              dockerfile: app.docker
          volumes:
              - ./:/var/www
          links:
              - db
          environment:
              - "DB_PORT=3306"
              - "DB_HOST=db"
      db:
          image: mysql:5.7
          environment:
              - "MYSQL_ROOT_PASSWORD=secret"
              - "MYSQL_DATABASE=dockerApp"
          ports:
              - "33061:3306"
  </code></pre>
  
  <p><code>app.docker</code></p>
  
  <pre><code>FROM php:7-fpm
  
  RUN apt-get update &amp;&amp; apt-get install -y libmcrypt-dev mysql-client \
      &amp;&amp; docker-php-ext-install pdo_mysql \
      &amp;&amp; pecl install mcrypt-1.0.1 docker-php-ext-enable mcrypt
  
  WORKDIR /var/www
  </code></pre>
  
  <p><code>vhost.conf</code></p>
  
  <pre><code>server {
      listen 80;
      root /var/www/public;
  
      location / {
          try_files $uri /index.php?$args;
      }
      location ~\.php$ {
          fastcgi_split_path_info ^(.+\.php)(/.+)$;
          fastcgi_pass app:9000;
          fastcgi_index index.php;
          include fastcgi_params;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_param PATH_INFO $fastcgi_path_info;
      }
  }
  
  server {
      listen 443;
      ssl on;
      root /var/www/public;
  
      ssl_certificate     /var/www/ssl-cert/server.crt;
      ssl_certificate_key /var/www/ssl-cert/server.key;
      ssl_password_file   /var/www/ssl-cert/passwords.txt;
      ssl_client_certificate /var/www/ssl-cert/ca.crt;
      ssl_verify_client on;
  }
  </code></pre>