Docker Community Forums

Share and learn in the Docker community.

[mongo] Unable to use external config file

can’t figure out how to expose the external config to the container. And why am I getting 2 different error messages? Appreciate your feedback.

az@dell5000 mongo_docker]$ docker images
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
mongo                   latest              ca8e14b1fda6        7 days ago          493MB

[az@dell5000 mongo_docker]$ ls -l
-rw-r--r-- 1 az az  626 Jan 28 01:30 mongod.conf

[az@dell5000 mongo_docker]$  file ./mongod.conf 
./mongod.conf: ASCII text

[az@dell5000 mongo_docker]$ docker run mongo -f mongod.conf
Error opening config file: Is a directory
try 'mongod --help' for more information

[az@dell5000 mongo_docker]$ docker run mongo --config mongod.conf
grep: mongod.conf: No such file or directory
error: unexpected "js-yaml.js" output while parsing config:
Error: couldn't open file :
@(shell eval):1:44
exiting with code -4

[az@dell5000 mongo_docker]$ docker -l debug run mongo --help
  --networkMessageCompressors arg (=snappy,zstd,zlib)
                                        Comma-separated list of compressors to 
                                        use for network messages

General options:
  -h [ --help ]                         Show this usage information
  --version                             Show version information
  -f [ --config ] arg                   Configuration file specifying 
                                        additional options

“mongod.conf” is the legitimate, unedited config from the installed deb package.

i’ve the same problem. do you find any solution?