How to use the rabbitmq docker compose yml file to build docker image?
docker, docker-compose, installation, rabbitmq
Solution
here you can find a few examples:
https://github.com/Gsantomaggio/rabbitmqexample/tree/master/cluster_docker_compose
version: "2"
services:
rabbit_node_1:
environment:
- RABBITMQ_ERLANG_COOKIE='secret_cookie'
networks:
- back
hostname: rabbit_node_1
image: "rabbitmq:3-management"
ports:
- "15672:15672"
- "5672:5672"
tty: true
volumes:
- rabbit1:/var/lib/rabbitmq
- ./conf/:/etc/rabbitmq/
command: bash -c "sleep 10; rabbitmq-server;"
rabbit_node_2:
environment:
- RABBITMQ_ERLANG_COOKIE='secret_cookie'
networks:
- back
hostname: rabbit_node_2
depends_on:
- rabbit_node_1
image: "rabbitmq:3-management"
ports:
- "15673:15672"
- "5673:5672"
tty: true
volumes:
- rabbit2:/var/lib/rabbitmq
- ./conf/:/etc/rabbitmq/
command: bash -c "sleep 10; rabbitmq-server; "
volumes:
rabbit1:
driver: local
rabbit2:
driver: local
networks:
back:
Problem
I'm new to docker and I know how to pull images of Ubuntu Linux and run it. I just wish to try out rabbitmq, and the site says we can use a `docker-composer.yml` file like this: ``` rabbitmq: image: rabbitmq:management ports: - "5672:5672" - "15672:15672" ``` I googled for a while but only find YAML related sites talks about how to write a complex YAML file. But my question is, how to use this YAML file to build/compose any docker image with rabbitmq so that I can start to use it?