title: MongoDB authentication fails in Docker
body: <p>My docker-compose.yml</p>
  <pre><code>  mongo:
      image: mongo
      volumes:
        - ./mongo:/data/db
      ports:
        - 27017:27017
      restart: always
      environment:
        MONGO_INITDB_ROOT_USERNAME: root
        MONGO_INITDB_ROOT_PASSWORD: pass
  
    mongo-express:
      image: mongo-express
      restart: always
      ports:
        - 8081:8081
      environment:
        ME_CONFIG_MONGODB_ADMINUSERNAME: root
        ME_CONFIG_MONGODB_ADMINPASSWORD: pass
        ME_CONFIG_MONGODB_URL: mongodb://root:pass@mongo:27017/
  </code></pre>
  <p>When I run <code>docker-compose up</code> it logs the following errors</p>
  <p>for the mongo service:
  <em>UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [mongo:27017] on first connect [MongoError: Authentication failed.</em></p>
  <p>and for the mongo-express service:
  <em>&quot;error&quot;:&quot;UserNotFound: Could not find user &quot;root&quot; for db &quot;admin&quot;</em></p>
  <p>I tried adding <code>?authSource=admin</code> to the ME_CONFIG_MONGODB_URL but the error remains.</p>