# Custom mongod.conf gives me an error

**URL:** <https://forums.percona.com/t/custom-mongod-conf-gives-me-an-error/11608>\
**Category:** Percona Server for MongoDB\
**Created:** [August 1, 2021, 2:38am UTC](https://forums.percona.com/t/custom-mongod-conf-gives-me-an-error/11608 "2021-08-01T02:38:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![favas](https://avatars.discourse-cdn.com/v4/letter/f/ee59a6/32.png) [@favas](https://forums.percona.com/u/favas)\
**Post date:** [August 1, 2021, 2:38am UTC](https://forums.percona.com/t/custom-mongod-conf-gives-me-an-error/11608/1 "2021-08-01T02:38:55Z")

</div>

```auto
> docker run --rm --name psmdb -e MONGO_INITDB_ROOT_USERNAME_FILE=/var/run/secrets/user -e MONGO_INITDB_ROOT_PASSWORD_FILE=/var/run/secrets/pass -e MONGO_INITDB_DATABASE=test -v /home/favas/percona-mongo/secrets:/var/run/secrets -v /home/favas/percona-mongo/mongod.conf:/etc/mongod.conf percona/percona-server-mongodb:4.4 --config=/etc/mongod.conf
> parse error: Invalid numeric literal at line 2, column 6
> parse error: Invalid numeric literal at line 2, column 6
> Unrecognized option: t.$date
> try 'mongod --help' for more information

```

Custom mongod.conf

```auto
> # mongod.conf, Percona Server for MongoDB
> # for documentation of all options, see:
> # http://docs.mongodb.org/manual/reference/configuration-options/
> 
> # Where and how to store data.
> storage:
> dbPath: /var/lib/mongodb
> journal:
> enabled: true
> # engine: wiredTiger
> # engine: inMemory
> 
> # Storage engine various options
> # More info for wiredTiger: https://docs.mongodb.com/v4.4/reference/configuration-options/#storage-wiredtiger-options
> # wiredTiger:
> # engineConfig:
> # cacheSizeGB: 1
> # checkpointSizeMB: 1000
> # statisticsLogDelaySecs: 0
> # journalCompressor: snappy
> # directoryForIndexes: false
> # collectionConfig:
> # blockCompressor: snappy
> # indexConfig:
> # prefixCompression: true
> 
> # More info for inMemory: https://www.percona.com/doc/percona-server-for-mongodb/4.4/inmemory.html#configuring-percona-memory-engine
> # inMemory:
> # engineConfig:
> # inMemorySizeGB: 1
> # statisticsLogDelaySecs: 0

# Two options below can be used for wiredTiger and inMemory storage engines
#setParameter:
# wiredTigerConcurrentReadTransactions: 128
# wiredTigerConcurrentWriteTransactions: 128

# where to write logging data.
#systemLog:
# destination: file
# logAppend: true
# path: /var/log/mongo/mongod.log

processManagement:
  fork: true
  pidFilePath: /var/run/mongod.pid

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1

#security:

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options:

#auditLog:

#snmp:

```

I want to run the docker image with the custom configuration . currently i am adjusting by changing the CMD entry to this so that i can use the below dbpath in dockerfile  
CMD [“mongod”, “–dbpath”, “/var/lib/mongod”]

---

<div class="post-metadata">

**Author:** ![Vadim\_Yalovets](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vadim_yalovets/32/43_2.png) [@Vadim\_Yalovets](https://forums.percona.com/u/Vadim_Yalovets)\
**Post date:** [August 1, 2021, 4:28pm UTC](https://forums.percona.com/t/custom-mongod-conf-gives-me-an-error/11608/2 "2021-08-01T16:28:22Z")

</div>

Hi @favas

Could you upload the used configuration file?

---

<div class="post-metadata">

**Author:** ![favas](https://avatars.discourse-cdn.com/v4/letter/f/ee59a6/32.png) [@favas](https://forums.percona.com/u/favas)\
**Post date:** [August 1, 2021, 4:42pm UTC](https://forums.percona.com/t/custom-mongod-conf-gives-me-an-error/11608/3 "2021-08-01T16:42:22Z")

</div>

The OP is the configuration I used . the block quotes gave me that text font

---

<div class="post-metadata">

**Author:** ![chchai](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@chchai](https://forums.percona.com/u/chchai)\
**Post date:** [August 12, 2021, 10:00am UTC](https://forums.percona.com/t/custom-mongod-conf-gives-me-an-error/11608/4 "2021-08-12T10:00:14Z")

</div>

I have the same problem on a Docker image of PSMDB version 4.4.5-7 and did a little investigation. The error is thrown by “jq”.

There is a problem with this line in entrypoint.sh when a custom mongodb.conf is passed in:

> mongo --norc --nodb --quiet --eval “load(‘/js-yaml.js’); printjson(jsyaml.load(cat($(\_js\_escape “$configPath”))))” \> “$jsonConfigFile”

js.yaml cannot be loaded. If you open up $jsonConfigFile, you will see the following:

> {“t”:{“$date”:“2021-08-12T09:27:59.080Z”},“s”:“E”, “c”:“-”, “id”:22779, “ctx”:“js”,“msg”:“file [{filename}] doesn’t exist”,“attr”:{“filename”:“/js-yaml.js”}}  
> Error: error loading js file: /js-yaml.js :  
> @(shell eval):1:1  
> exiting with code -4

The $jsonConfigFile is subsequently used below in this line, thus it generates the same error again:

> elif \_parse\_config “$@” && jq --exit-status ‘.net.bindIp // .net.bindIpAll’ “$jsonConfigFile” \> /dev/null; then

Is there any chance of fixing this problem soon?
