Searanox
Searanox

Reputation: 61

Error Running MongoDB via Docker Compose on ECS Fargate

I've been trying to launch a containerized mongoDB instance using docker-compose onto ECS w/ Fargate, here is my docker compose configuration:

mongo:
 image: mongo:latest
 restart: always
 environment:
  MONGO_INITDB_USERNAME: root
  MONGO_INITDB_DATABASE: db-name
 volumes:
  - ./migration/init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
 ports:
  - "27017:27017"

Using docker compose version : 3

I'm getting the following error: FATA[0000] ClientException: Fargate compatible task definitions do not support sourcePath

Any ideas on what I'm doing wrong?

Upvotes: 0

Views: 427

Answers (1)

mreferre
mreferre

Reputation: 6063

You can't mount a local file/folder (.migration/init.js) to a task in the cloud. I am not familiar with Mongo so I am not 100% sure what that file does but the easiest way to solve this would be to create a new docker image FROM mongo where the only line would be a ADD to add the init.js file where you need it inside the container (/docker-entrypoint-initdb.d/mongo-init.js ?). The "even easier" way to solve this would be to eliminate the volume directive in the compose (but I don't know what the ramifications of doing so would be for the mongo container you need to run).

Upvotes: 1

Related Questions