Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mongodb Docker Meteor开发安装程序仍在连接到本地数据库_Mongodb_Meteor_Docker Compose - Fatal编程技术网

Mongodb Docker Meteor开发安装程序仍在连接到本地数据库

Mongodb Docker Meteor开发安装程序仍在连接到本地数据库,mongodb,meteor,docker-compose,Mongodb,Meteor,Docker Compose,我正在尝试为我的meteor应用程序设置docker compose设置。码头工人是这样写的 version: '2' services: web: build: docker/web ports: - "3000:3000" volumes: - .:/home/meteor/app container_name: newkeyz-web links: - mongo environment:

我正在尝试为我的meteor应用程序设置docker compose设置。码头工人是这样写的

version: '2'
services:
  web:
    build: docker/web
    ports:
      - "3000:3000"
    volumes:
      - .:/home/meteor/app
    container_name: newkeyz-web
    links:
      - mongo
    environment:
      - MONGO_URL=mongodb://mongo:27017/meteor
    command: ["meteor","npm","start"]
  mongo:
    image: mongo
    volumes:
      - ./data:/data/db
    ports:
      - "27017:27017"
当容器启动时,它会使用正确的命令启动-

newkeyz-web | > newkeyz@1.9.5 start /home/meteor/app
newkeyz-web | > MONGO_URL=mongodb://mongo:27017/meteor meteor --settings settings.json
但是meteor应用程序仍然尝试连接到本地mongodb实例

MongoError:无法连接到服务器[127.0.0.1:3001]

我尝试了在命令中指定mongo_url的所有不同方法

export MONGO_URL=mongodb://mongo:27017/meteor && meteor --settings settings.json

MONGO_URL=mongodb://mongo:27017/meteor meteor --settings settings.json

meteor --settings settings.json
我甚至在Dockerfile中有一个ENV,但没有运气

ENV MONGO\u URLmongodb://mongo:27017/meteor


我做错了什么?任何指点都将不胜感激。

我发现了问题。agenda npm init代码试图基于不同的环境变量连接到本地数据库

export const agenda = new Agenda({
  maxConcurrency: 1,
  db: {
    address: process.env.MONGODB_URI,
  },
});

在将其更改为正确的变量后,它工作了