Skip to content

ansmirnov/mongo-express-in-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 

Repository files navigation

Running Mongo-express in docker

Contents

Select the version of the docker image

IMAGE=mongo-express
TAG=0.54.0

Set container name

NAME=mongo-express

Pull the docker image

docker pull $IMAGE:$TAG

Configure the mongo-express instance

Contents of the .env file.

ME_CONFIG_BASICAUTH_USERNAME=user
ME_CONFIG_BASICAUTH_PASSWORD=webpassword
ME_CONFIG_MONGODB_ADMINUSERNAME=user
ME_CONFIG_MONGODB_ADMINPASSWORD=topsecret
ME_CONFIG_MONGODB_SERVER=mongodb
ME_CONFIG_MONGODB_PORT=27017

Set the MongoDB container name

MONGODB_CONTAINER=mongodb

Set the network parameters

INTERFACE=0.0.0.0
PORT=8081

Run mongo-express

docker run -it --rm -d \
    --name $NAME \
    -p $INTERFACE:$PORT:8081 \
    --env-file .env \
    --link $MONGODB_CONTAINER \
    mongo-express

Use mongo-express

Open the URL in a browser: http://$INTERFACE:8081/.

See the container logs

docker logs $NAME

Kill the container

docker kill $NAME

References

  1. https://hub.docker.com/_/mongo-express/