- Select the version of the docker image
- Set container name
- Pull the docker image
- Configure the mongo-express instance
- Set the MongoDB container name
- Set the network parameters
- Run mongo-express
- Use mongo-express
- See the container logs
- Kill the container
- References
IMAGE=mongo-express
TAG=0.54.0
NAME=mongo-express
docker pull $IMAGE:$TAG
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
MONGODB_CONTAINER=mongodb
INTERFACE=0.0.0.0
PORT=8081
docker run -it --rm -d \
--name $NAME \
-p $INTERFACE:$PORT:8081 \
--env-file .env \
--link $MONGODB_CONTAINER \
mongo-express
Open the URL in a browser: http://$INTERFACE:8081/.
docker logs $NAME
docker kill $NAME