Thanks @JamesT for th reply.
Since in docker service/systemctl is not available to control the mongod service.
I tried to stop the mongo service by db.shutdownServer() and also kill it manually.
In both the cases docker get stop and exited.
Could you please suggest how to stop the mongo service inside the docker, so I can start it with encryption command.
I don’t have experience with docker. One thing to keep in mind (if you’re not already aware of it) is that when moving from unencryped to encrypted, you’ll need to make sure /data (storage.dbPath) is empty before you restart mongod.