MongoDb in Azure Container Instance Fails after some time

I have mongoDB running in Azure Container Instance. DB run constantly and it was OK, but it happens 2 times that container went in Failed state. The Fail state happened in time range of one month. This is my Dockefile:

FROM ubuntu:xenial

# Update the repository sources list
RUN apt-get update && apt-get install -y wget gnupg apt-transport-https ca-certificates vim 

#Import GPG Key from https://www.mongodb.org/static/pgp/server-4.2.asc:
RUN wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | apt-key add -

#Create a list file /etc/apt/sources.list.d/mongodb-org-4.2.list for MongoDB
RUN echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.2 multiverse" |  tee /etc/apt/sources.list.d/mongodb-org-4.2.list

#Install the latest stable version of MongoDB
RUN apt-get update && apt-get install -y mongodb-org 
RUN mkdir -p /data/db

# Expose the default port
EXPOSE 27017

CMD ["--port 27017", "--smallfiles"]

# Set default container command and overwrite default address 127.0.0.1 with 0.0.0.0
ENTRYPOINT usr/bin/mongod --bind_ip 0.0.0.0

I don't have logs, so I believe it's hard to say what is the cause, but is there some reason why container fails looking on Dockerfile? The DB container must run without interruptions, so this is quite critical issue.

1 answer

  • answered 2020-07-11 03:14 Atul

    I don't see any issue in the dockerfile which you have shared here. However if you have any doubt about dockerfile of mongo, you can use the official mongodb dockerfile (https://github.com/docker-library/mongo).

    In order to actual troubleshoot the problem, you will need to understand what exactly happened with the containers and would needs logs for it.