In docker container how to run another container command?

Example:
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.

  • What is the benefit of reverse proxy if we can expose to port 80 directly?
  • Docker - Error response from daemon: client is newer than server
  • Connecting zeppelin docker with hive
  • How to avoid reinstalling packages when building Docker image for Python projects?
  • Error when installing docker-compose using ansible-playbook
  • What are the possibilities to debug a docker swarm?
  • Dockerized WSO2 Identity Server Version 2.3
  • Copy all SBT dependencies to local folder
  • Is possible to deploy existing app to Docker
  • Docker container can't see a serialport device
  • Developing and version control in a shared data-container
  • Installing libLAS on docker python - No such file or directory
  • 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.