11/24/2021»»Wednesday

Mongodb Docker Install

Connecting to MongoDB Server Docker Container. Having the container installed up and running, you will notice that no extra step or dependency installation was previously required, apart from the docker binaries. Now, it is time to access the container MongoDB shell and issue a basic command like “show dbs”. In this case, installing and configuring the installation of services such as MongoDB or Redis is tedius. Alternative to doing that is spin n ing up a Docker image of the database or tools we need and then communicate it in a way we want. The communication can be done via HTTP or TCP. Install the Docker. This is pretty forward step to.

User a dockerfile to automate creating a container.

Mongodb Docker Install

Docker has a simple DSL that lets you automate all of these steps to make a conainer.

Docker file syntax

Every line in a docker file has the following structure: INSTRUCTION arguments

Comments are ignored, and the first line in the docker file should contain the command FROM <image

Commands available full details

  • FROM (select the base image)
  • MAINTAINER (Set the author field for images)
  • RUN (run a command, and commit)
  • CMD (the default execution command for the container)
  • EXPOSE (set the port to be publicly exposed)
  • ENV (set environment variables)
  • ADD (add files from source and copy them to the container)
  • ENTRYPOINT (configure the container to run as an executable)
  • VOLUME (add a volume)
  • USER (set the user)
  • WORKDIR (set working directory)

MongoDB dockerfile

We create a dockerfile, and just use all the same commands we used previously touch Dockerfile

Install Mongodb Docker Centos

Then we issue:

sudo docker build -t codiez/mongodb .

Docker

and start it up with...

sudo docker run -d codiez/mongodb

Install

Mongodb Docker How To

Originally posted to: http://blog.codiez.co.za/2013/09/setup-mongodb-container-docker-file/

Most Viewed Posts