A ready to use docker-compose configuration with rabbitmq,mongodb,mongo-express.
Containers:
- RabbitMQ
- MongoDB
- Mongo-Express
git clone https://github.com/stdakov/docker-rabbit-mongo.git
cd docker-rabbit-mongo/
docker-compose up -d
- http://localhost:15672/
- username:
guest
- password:
guest
- http://localhost:8081/
- username: ``
- password: ``
If you want to change some container configuration you need to rebuild the container:
docker-compose up -d --no-deps --build {service-name}
docker-compose exec {service-name} bash
docker-compose restart
docker-compose stop
docker-compose down -v
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"
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();\
}\
})\
"
- 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
- run mongodb
docker run --name mongodb -p 27017:27017 -d mongo:latest
- 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)