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.

  • accessing services outside kubernetes
  • Dial tcp i/o timeout with Docker in Gitlab CI build
  • Parse docker logs with logstash
  • Create Jenkins Docker Image with pre configured jobs
  • How to share a Docker container folder when it is not empty?
  • Importing .so file made with Cython results in ImportError: … undefined symbol
  • Problems running npm install during docker-compose build
  • Docker container that depends on file in other container
  • Kafka cannot resolve Zookeper's DNS name
  • docker not responding when using different data directory
  • $GEM_HOME and $GEM_PATH are wrongly set in Passenger
  • Linking to a Docker memcached container
  • 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.