MongoDb installation as azure container instance with volume as file sharing

Domenico Zurlo 1 Reputation point
2021-11-30T09:01:12.837+00:00

I have created a container instance group for webprotege installation, that contains a docker image of mongoDB (mongo:4.1-bionic).
Since the containers are stateless, I need to associate a volume as file sharing to mongoDB for data persistance.
So I created the group with the following docker-compose.yml, setting a path for the volume different form data/db, that is not possible to associate.

version: '3'

services:
wpmongo:
image: mongo:4.1-bionic
volumes:

  • db:/var/logs
    webprotege:
    image: protegeproject/webprotege
    restart: always
    ports:
  • 8080:8080
    depends_on:
  • wpmongo

volumes:
db:
driver: azure_file
driver_opts:
share_name: sharename
storage_account_name: storageaccount

The issue is that, mongoDb continue to get the data from data/db folder and I think that the data are not persistant.
Could you, please help us?

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
701 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Domenico Zurlo 1 Reputation point
    2021-12-02T19:19:45.97+00:00

    Hello,
    I have used the following Dockerfile and I have used the path /data/db2, but I receive the same error as when I use the the path /data/db as volume.

    DOCKERFILE:

    FROM mongo:latest

    Modify child mongo to use /data/db2 as dbpath (because /data/db wont persist the build)

    RUN mkdir -p /data/db2 \
    && echo "dbpath = /data/db2" > /etc/mongodb.conf \
    && chown -R mongodb:mongodb /data/db2

    COPY . /data/db2

    RUN mongod --fork --logpath /var/log/mongodb.log --dbpath /data/db2 \
    && mongod --dbpath /data/db2 --shutdown \
    && chown -R mongodb /data/db2

    CMD ["mongod", "--config", "/etc/mongodb.conf"]

    Below you can find the docker-compose.yml:

    version: '3'

    services:
    wpmongo:
    image: domezurlo/azure-mongo:latest
    volumes:

    • db:/data/db2
      webprotege:
      image: protegeproject/webprotege
      restart: always
      ports:
    • 8080:8080
      depends_on:
    • wpmongo

    volumes:
    db:
    driver: azure_file
    driver_opts:
    share_name: share_name
    storage_account_name: storage_account_name

    The error is the following:

    {"t":{"$date":"2021-12-02T18:42:44.195+00:00"},"s":"E", "c":"STORAGE", "id":22435, "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":1,"message":"[1638470564:195329][465:0x7ff2d3485c80], connection: __posix_open_file, 808: /data/db2/WiredTiger.wt: handle-open: open: Operation not permitted"}}
    {"t":{"$date":"2021-12-02T18:42:44.202+00:00"},"s":"W", "c":"STORAGE", "id":22347, "ctx":"initandlisten","msg":"Failed to start up WiredTiger under any compatibility version. This may be due to an unsupported upgrade or downgrade."}
    {"t":{"$date":"2021-12-02T18:42:44.202+00:00"},"s":"F", "c":"STORAGE", "id":28595, "ctx":"initandlisten","msg":"Terminating.","attr":{"reason":"1: Operation not permitted"}}
    {"t":{"$date":"2021-12-02T18:42:44.202+00:00"},"s":"F", "c":"-", "id":23091, "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":28595,"file":"src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp","line":687}}
    {"t":{"$date":"2021-12-02T18:42:44.202+00:00"},"s":"F", "c":"-", "id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}

    Could you help me, please?


  2. Domenico Zurlo 1 Reputation point
    2021-12-03T16:03:03.683+00:00

    Hello @SRIJIT-BOSE-MSFT ,
    I have no more that error. The fresh logs now are the following:

    {"t":{"$date":"2021-12-03T13:56:18.175+00:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/etc/mongodb.conf","net":{"bindIp":"*"},"storage":{"dbPath":"/data/db2"}}}}
    {"t":{"$date":"2021-12-03T13:56:18.892+00:00"},"s":"I", "c":"STORAGE", "id":22315, "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=256M,session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),builtin_extension_config=(zstd=(compression_level=6)),file_manager=(close_idle_time=600,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress,compact_progress],"}}
    {"t":{"$date":"2021-12-03T13:56:22.093+00:00"},"s":"E", "c":"STORAGE", "id":22435, "ctx":"initandlisten","msg":"WiredTiger error","attr":{"error":17,"message":"[1638539782:93395][90:0x7fadd11b8c80], connection: __posix_open_file, 808: /data/db2/WiredTiger.wt: handle-open: open: File exists"}}


  3. Tom Zhu 1 Reputation point Microsoft Employee
    2023-04-18T03:46:17.53+00:00

    please check this link whether it can help.
    https://github.com/bitnami/charts/issues/3106

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.