2

Problem:
I'm using the mongodb/mongodb-atlas-local Docker image in our CI/CD pipeline for running tests. While the verbose logging is acceptable for local development, it becomes problematic in CI/CD environments.
When a test fails (which happens frequently during development), we're forced to download approximately ~1GB of MongoDB logs from our CI/CD system, most of which are unnecessary for debugging the actual test failures.

I use a standard docker-compose.yml

services:
  mongodb-atlas:
    image: mongodb/mongodb-atlas-local:7
    ports:
      - "27025:27017"
    volumes:
      - mongodb-atlas-data:/data
    environment:
      - MONGODB_REPLICA_SET_NAME=rs0
    networks:
      test:
        aliases:
          - mongodb-atlas.test.com
    restart: unless-stopped
networks:
  test:
    driver: bridge
volumes:
  mongodb-atlas-data:

also I've tried overriding mongod.conf, but none of the changes take effect.

    volumes:
      - mongod.conf:/etc/mongod.conf:ro

Question:
Is there a way to configure the mongodb-atlas-local Docker image to reduce log verbosity?

Specifically:

  • Can I set a lower log level via environment variables or configuration files?
  • Is there a recommended approach for using this image in CI/CD environments?
  • Are there any Docker run parameters or MongoDB configuration options that would help reduce log output?

Ideal Solution:
A configuration option that would reduce logging to only errors and warnings, or a way to disable verbose operational logs while keeping test-relevant information.

Any guidance or workarounds would be greatly appreciated!

updated:

This image is not a simple MongoDB image - it contains both MongoDB Server (mongod) and Atlas Search (mongot). It uses /usr/local/bin/runner server as the entrypoint to orchestrate starting both services, which means we cannot override the start command. The runner starts mongod with hardcoded command-line arguments rather than using a configuration file, as confirmed by db.adminCommand({ getCmdLineOpts: 1 }) showing only argv parameters without a --config flag.

     {
       argv: [
         'mongod',
         '--replSet',
         'local_dev_atlas',
         '--dbpath',
         '/data/db',
         '--keyFile',
         '/data/configdb/keyfile',
         '--maxConns',
         '32200',
         '--bind_ip_all',
         '--setParameter',
         'mongotHost=localhost:27027',
         '--setParameter',
         'searchIndexManagementHostAndPort=localhost:27027',
         '--auth'
       ],
       ...
     }
3
  • can you share for me your mongdb init function ? Commented Nov 19 at 6:46
  • I use the docker-compose.yml file to run the instance Commented Nov 19 at 22:44
  • Since this is a configuration issue, this would be more suitable for Server Fault or DevOps. Afaict, the image seems to be proprietary too (Atlas is the cloud product), so asking on Mongo's forums or their customer service may make sense too, as users may not know the answer Commented Nov 22 at 4:23

1 Answer 1

0

try to use a mongod custom config file

systemLog:
  destination: file
  path: /var/log/mongodb/mongod.log
  logAppend: true
  verbosity: 1  # 0 = default (info), 1 = warning, 2 = more verbose, etc.
services:
  mongodb-atlas:
    image: mongodb/mongodb-atlas-local:7
    ports:
      - "27025:27017"
    volumes:
      - mongodb-atlas-data:/data
      - ./mongod.conf:/etc/mongod.conf:ro
    environment:
      - MONGODB_REPLICA_SET_NAME=rs0
    command: ["mongod", "--quiet", "--config", "/etc/mongod.conf"]
    networks:
      test:
        aliases:
          - mongodb-atlas.test.com
    restart: unless-stopped

volumes:
  mongodb-atlas-data:

networks:
  test:
    driver: bridge
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.