$ cat mongo-test-db.yml version: '2.4' services: mongo-test-db: image: "mongo:latest" container_name: mongo-test-db volumes: - .mongo-test-db/db:/data/db restart: on-failure cpus: 2 mem_limit: 2gb ports: - "27002:27017" healthcheck: test: echo 'db.stats().ok' | mongo localhost:27017/just4testNur --quiet interval: 5s timeout: 5s retries: 12 networks: default: external: name: agis-net $ docker-compose -f mongo-test-db.yml up -d Creating mongo-test-db ... done $ docker-compose -f mongo-test-db.yml ps Name Command State Ports ------------------------------------------------------------------------------------- mongo-test-db docker-entrypoint.sh mongod Up (healthy) 0.0.0.0:27002->27017/tcp
$ cat agis-mongo-db-fresh.yml version: '2.4' services: agis-mongo-db-fresh: image: "mongo:4.4" container_name: agis-mongo-db-fresh volumes: - ./agis-mongo-db-fresh/db:/data/db ports: - "27001:27017" restart: on-failure cpus: 2 mem_limit: 2gb healthcheck: test: echo 'db.stats().ok' | mongo localhost:27017/just4testNur --quiet interval: 5s timeout: 5s retries: 12 networks: default: external: name: agis-net $ docker-compose -f agis-mongo-db-fresh.yml up -d Creating agis-mongo-db-fresh ... done $ docker-compose -f agis-mongo-db-fresh.yml ps Name Command State Ports ---------------------------------------------------------------------------------------------------- agis-mongo-db-fresh docker-entrypoint.sh mongod Up (health: starting) 0.0.0.0:27001->27017/tcp $ docker-compose -f agis-mongo-db-fresh.yml ps Name Command State Ports ------------------------------------------------------------------------------------------- agis-mongo-db-fresh docker-entrypoint.sh mongod Up (healthy) 0.0.0.0:27001->27017/tcp