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.

  • Reusing a previoulsy used docker container
  • Marathon won't launch docker container
  • Docker-Compose Elkstack
  • Docker build failing when using gcsfuse to mount google storage
  • openshift v3 sed couldn't open temporary file
  • Deploying node.js web app along with docker
  • piping data to exec_create & stdin/stdout
  • How specify the size of a shared Docker volume?
  • How to preserve apt-cache archive directory when using docker / host volumes
  • Docker without any https/SSL validation?
  • How to include modified configuration files in a docker image?
  • Flush Flower database occasionally and/or exit gracefully from Docker?
  • 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.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.