简体   繁体   中英

Docker compose with MongoDB (and Microsoft Azure)

I'm trying to launch an app on Microsoft Azure using docker-compose file. This is the error I'm getting in the logs

2019-06-18T18:12:55.319003252Z Successfully added user: {
2019-06-18T18:12:55.361353763Z     "user" : "myuser1",
2019-06-18T18:12:55.361371063Z     "roles" : [
2019-06-18T18:12:55.361387163Z         {
2019-06-18T18:12:55.361392063Z             "role" : "root",
2019-06-18T18:12:55.361396763Z             "db" : "admin"
2019-06-18T18:12:55.361401363Z         }
2019-06-18T18:12:55.361405563Z     ]
2019-06-18T18:12:55.361409964Z }
2019-06-18T18:12:55.367946981Z 2019-06-18T18:12:55.331+0000 E -        [main] Error saving history file: FileOpenFailed: Unable to open() file /home/mongodb/.dbshell: Unknown error
2019-06-18T18:12:55.399399764Z 
2019-06-18T18:12:55.399413964Z 2019-06-18T18:12:55.389+0000 I NETWORK  [conn2] end connection 127.0.0.1:50370 (0 connections now open)
2019-06-18T18:12:55.465992339Z /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
2019-06-18T18:12:55.466010339Z 
2019-06-18T18:12:58.011530247Z 2019-06-18T18:12:58.011+0000 I CONTROL  [main] ***** SERVER RESTARTED *****

This is how my part for mongoDB looks like in docker-compose.yml :

version: '3'
services:
  ...other services
  mongo:
    image: mongo:latest
    container_name: my-mongo
    restart: unless-stopped
    volumes:
      - my-mongo:/data/db
    environment:
      - MONGO_INITDB_ROOT_USERNAME=myusername
      - MONGO_INITDB_ROOT_PASSWORD=mysupersecretpassword
    ports:
      - 27017:27017
    networks:
      - myservices-net

The whole docker-compose file works locally on my machine, but it does not want to work on Microsoft Azure.

I've found this issue on GitHub but I'm not really sure how to apply the changes to my docker-compose file. Would really appreciate any help here!

For your issue, the possible reason would be that the networks property is not supported in the compose file in Azure Web App. You can see all the Compose options supported and unsupported.

Supported options

  • command
  • entrypoint
  • environment
  • image
  • ports
  • restart
  • services
  • volumes

Unsupported options

  • build (not allowed)
  • depends_on (ignored)
  • networks (ignored)
  • secrets (ignored)
  • ports other than 80 and 8080 (ignored)

For more details, see Docker Compose options .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM