title: Problem with connecting mongo express service in docker
body: <p>I have a docker configuration where I started nginx server. Now I have to run mongo and mongo-express to be able to connect to my database. When I put my configuration for those two in docker-compose.yml and try docker compose up, mongo service starts but mongo express shows this error</p>
  <pre><code>Could not connect to database using connectionString: mongodb://root:pass@mongodb:27017/&quot; mongo-express_1 | (node:8) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [mongodb:27017] on first connect
  </code></pre>
  <p>Any help is appreciated, here are my configurations.</p>
  <p>docker-compose.yml</p>
  <pre><code>version: &quot;3&quot;
  
  services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    image: cryptoterminal
    container_name: app
    restart: unless-stopped
    volumes:
      - ./:/var/www
  
  webserver:
    build:
      context: .
      dockerfile: Dockerfile_Nginx
    image: nginx
    container_name: webserver
    restart: unless-stopped
    ports:
      - &quot;8080:80&quot;
    volumes: 
      - ./:/var/www
      - ./config/nginx/:/etc/nginx/conf.d/
    depends_on:
      - app
  mongo:
    image: mongo
    environment:
        - MONGO_INITDB_ROOT_USERNAME=root
        - MONGO_INITDB_ROOT_PASSWORD=pass
  mongo-express:
    image: mongo-express
    environment:
      - ME_CONFIG_MONGODB_SERVER=mongodb
      - ME_CONFIG_MONGODB_ENABLE_ADMIN=true
      - ME_CONFIG_MONGODB_ADMINUSERNAME=root
      - ME_CONFIG_MONGODB_ADMINPASSWORD=pass
      - ME_CONFIG_BASICAUTH_USERNAME=admin
      - ME_CONFIG_BASICAUTH_PASSWORD=admin123
    depends_on:
        - mongo
    ports:
      - &quot;8888:8081&quot;
  </code></pre>
  <p>Dockerfile</p>
  <pre><code>FROM php:7.4-fpm-alpine
  
  WORKDIR /var/www
  
  RUN apk update &amp;&amp; apk add \
  
  build-base \
  vim
  
  RUN addgroup -g 1000 -S www &amp;&amp; \
  adduser -u 1000 -S www -G www
  
  USER www
  
  COPY --chown=www:www . /var/www
  
  EXPOSE 9000
  </code></pre>
  <p>Dockerfile_Nginx</p>
  <pre><code>FROM nginx:alpine
  
  COPY ./config/nginx/app.conf /etc/nginx/conf.d/app.conf
  
  COPY . /var/www
  </code></pre>
  <p>.env file</p>
  <pre><code>MONGO_DB_URI=mongodb://root:pass@mongodb:27017/crypto-terminal?authSource=admin
  </code></pre>
  <p>app.conf file</p>
  <pre><code>server {
      listen 80;
      index index.php index.html;
      error_log /var/log/nginx/error.log;
      access_log /var/log/nginx/access.log;
      root /var/www;
      location ~ \.php$ {
          try_files $uri =404;
          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;
      }
      location / {
          try_files $uri $uri/ /index.php?$query_string;
      }
  }
  </code></pre>
  <p>folder structure</p>
  <pre><code>project_folder
      php
          config
              nginx
                  app.conf
      .env
      Dockerfile
      Dockerfile_Nginx
      docker-compose.yml
      index.php
  </code></pre>