Skip to content

A ready to use docker-compose configuration with rabbitmq,mongodb,mongo-express.

License

Notifications You must be signed in to change notification settings

stdakov/docker-rabbit-mongo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-rabbit-mongo

A ready to use docker-compose configuration with rabbitmq,mongodb,mongo-express.

Containers:

  • RabbitMQ
  • MongoDB
  • Mongo-Express

Installation

git clone https://github.com/stdakov/docker-rabbit-mongo.git
cd docker-rabbit-mongo/
docker-compose up -d

rabbitMQ

mongo-express

Update container configuration

If you want to change some container configuration you need to rebuild the container:

docker-compose up -d --no-deps --build {service-name}

Connect to container:

docker-compose exec {service-name} bash

Restart everything:

docker-compose restart

Stop everything:

docker-compose stop

Remove everything:

docker-compose down -v

Reset:

rabbitMQ:
docker-compose exec rabbit sh -c "rabbitmqctl stop_app; rabbitmqctl reset; rabbitmqctl start_app"

or

docker exec rabbit sh -c "rabbitmqctl stop_app; rabbitmqctl reset; rabbitmqctl start_app"
mongoDB:
docker-compose exec mongo mongo --eval "\
Mongo().getDBNames().forEach(function(x) {\
  if (['admin', 'config', 'local'].indexOf(x) < 0) {\
    Mongo().getDB(x).dropDatabase();\
  }\
})\
"

or

docker exec -it mongo mongo ir --eval "\
Mongo().getDBNames().forEach(function(x) {\
  if (['admin', 'config', 'local'].indexOf(x) < 0) {\
    Mongo().getDB(x).dropDatabase();\
  }\
})\
"

In you want to use docker without docker compose:

  1. run rabbitMQ
docker run --name rabbitmq --hostname rabbit  -p 5672:5672 -p 15672:15672 -e RABBITMQ_DEFAULT_USER=guest -e RABBITMQ_DEFAULT_PASS=guest -d rabbitmq:3-management
  1. run mongodb
docker run --name mongodb -p 27017:27017 -d mongo:latest
  1. remove rabbitmq:
docker ps -a
docker rm -f `<containerID>`
docker volume ls
docker volume rm `<volumeName>`

The docker system prune command will remove all stopped containers, all dangling images, and all unused networks:

docker system prune

You’ll be prompted to continue, use the -f or --force flag to bypass the prompt. WARNING! This will remove: - all stopped containers - all networks not used by at least one container - all dangling images - all build cache Are you sure you want to continue? [y/N]

If you also want to remove all unused volumes, pass the --volumes flag:

docker system prune --volumes

WARNING! This will remove: - all stopped containers - all networks not used by at least one container - all volumes not used by at least one container - all dangling images - all build cache Are you sure you want to continue? [y/N] y

docker kill $(docker ps -q)
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker rm -v $(docker ps -a -q)

About

A ready to use docker-compose configuration with rabbitmq,mongodb,mongo-express.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published