Can't drop-in Percona-Server-MongoDB image without errors

I am currently creating a Docker Container with the following image:

FROM mongo
EXPOSE 27017

This pulls the latest mongo official docker image from DockerHub.
I was hoping to drop-in percona’s mongo image to replace the official, but I’m running into an issue. This is what the dockerfile looks like:

FROM percona/percona-server-mongodb
EXPOSE 27017

The container builds fine, but when I try to spinup my deployment environment with docker compose up, I get the following issue:

mongo_1     | {"t":{"$date":"2022-06-27T17:05:17.030+00:00"},"s":"E",  
"c":"CONTROL",  "id":20557,   "ctx":"initandlisten",
"msg":"DBException in initAndListen, terminating",
"attr":{"error":"IllegalOperation: Attempted to create a lock file on a read-only directory: /data/db"}
}

Once the lock file error happens, everything shuts down

1 Like

I fixed the above issue by changing permissions on the database/ collection within my deployment folder. This is not an issue I had in the past with mongo’s image, so I’m unsure as to why I’m getting it now.

Anyways, even with this issue fixed, I’m still having errors replacing the official mongo image with the Percona-Server-MongoDB container. I am currently getting a ECONNREFUSED for localhost:27017 MongoNetworkError

1 Like