In docker container how to run another container command?
I have a image ubuntu and another image mongodb.
How can I run mongod(mongodb command) or another mongodb image command when I’m running ubuntu image.
One Solution collect form web for “In docker container how to run another container command?”
- Any image will generate one or more containers.
- Every container is isolated of others.
If you can run MongoD inside a Ubuntu based container you need to install MongoDB inside your Ubuntu based container.
But, if you need connect on mondodb to create a user, change settings of your mongod instance, you don’t need a second container, on mongodb container you can execute commands to perform that.
On mongodb documentation at docker hub, the example about mondodb security talks about it, the example explain how to connect your shell to container, and show how execute
docker exec -it [mongodbContainerName|mongodbContainerId] mongo admin to get access to administration of mongodb using console.