If you’re a software developer, you know the deal: we’re always installing tools. Databases, message brokers, Redis—whatever the project calls for, we grab it. But here’s the thing: a lot of these tools only get used occasionally. Maybe I need RabbitMQ for a project one month, then it sits there unused until the next time I need it. Or maybe I just following a tutorial that used database that I rarely used like PostgreSQL.
Now, if all of these tools are installed directly on my laptop, they start to hog resources, slowing things down even when I’m not using them. It’s annoying to have my laptop feeling sluggish just because I’ve got background services running for stuff I don’t even need every day.
To deal with this, I started using Docker to handle the tools I don’t need constantly running. With Docker, I can spin up a tool only when I need it and shut it down when I’m done. Super easy and way more efficient!
I also set up a few Docker Compose files for my go-to tools, so whenever I need, say, RabbitMQ or MongoDB, I just type docker compose up
, and boom—my tool’s ready. And when I’m done, I just stop the container. I can even delete the image if I want to. Clean and simple.
Here are the Docker Compose files I put together for a few popular tools. Just create a folder for spesific tools, like rabbitmq
. Then create a docker-compose.yaml
it that folder. Whenever you want to use it, just go to that directory, then run docker compose up
. If you finished, just press Ctrl + C
to stop the container. Feel free to use them if you’re looking to keep your dev environment streamlined!
Notes:
guest:guest
to loginservices:
rabbitmq:
image: rabbitmq:3-management
container_name: rabbitmq
ports:
- 5672:5672 # for sender and consumer connections
- 15672:15672 # for serve RabbitMQ GUI
volumes:
- ${HOME}/Dev/docker/rabbitmq/data/:/var/lib/rabbitmq
- ${HOME}/Dev/docker/rabbitmq/log/:/var/log/rabbitmq
networks:
- rabbitmq-network
networks:
rabbitmq-network:
driver: bridge
services:
mongodb:
container_name: mongodb
image: mongo:latest
ports:
- 27017:27017
volumes:
- ${HOME}/Development/docker/mongodb/data/:/data/db
environment:
MONGO_INITDB_ROOT_USERNAME: your_username
MONGO_INITDB_ROOT_PASSWORD: your_password
networks:
- mongodb-network
networks:
mongodb-network:
driver: bridge
Notes:
pgadmin
GUI, please use host.docker.internal
as host.pgadmin
if you want.services:
postgres:
image: postgres
container_name: postgres
environment:
POSTGRES_PASSWORD: your_password
volumes:
- ${HOME}/Development/docker/postgresql/postgres/data/:/var/lib/postgresql/data
ports:
- 5432:5432
networks:
- postgres-network
pgadmin:
image: dpage/pgadmin4
container_name: pgadmin
depends_on:
postgres:
condition: service_completed_successfully
ports:
- 8888:80
environment:
PGADMIN_DEFAULT_EMAIL: your_email@gmail.com
PGADMIN_DEFAULT_PASSWORD: your_password
volumes:
- ${HOME}/Development/docker/postgresql/pgadmin/data/:/var/lib/pgadmin
networks:
- postgres-network
networks:
postgres-network:
driver: bridge
Notes:
phpmyadmin
if you want.phpmyadmin
GUI, please use host.docker.internal
as host/serverservices:
mysql:
image: mysql:latest
container_name: mysql
environment:
MYSQL_ROOT_PASSWORD: your_password
volumes:
- ${HOME}/Development/docker/mysql/data/:/var/lib/mysql
ports:
- 3306:3306
networks:
- mysql-network
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: phpmyadmin
depends_on:
mysql:
condition: service_completed_successfully
environment:
MYSQL_ROOT_PASSWORD: your_password
PMA_HOST: mysql
PMA_PORT: 3307
PMA_ARBITRARY: 1
ports:
- 8080:80
networks:
- mysql-network
networks:
mysql-network:
driver: bridge
Notes:
redisinsight
GUI, please use host.docker.internal
as hostredisinsight
if you want.services:
redis:
image: redis:latest
container_name: redis
volumes:
- ${HOME}/Development/docker/redis/redis/data/:/data
ports:
- 6379:6379
networks:
- redis-network
entrypoint: redis-server --appendonly yes --requirepass granite97
redisinsight:
image: redis/redisinsight:latest
container_name: redisinsight
depends_on:
redis:
condition: service_completed_successfully
volumes:
- ${HOME}/Development/docker/redis/redisinsight/data/:/data
ports:
- 5540:5540
networks:
- redis-network
networks:
redis-network:
driver: bridge
services:
sonarqube:
image: sonarqube:community
container_name: sonarqube
environment:
SONAR_ES_BOOTSTRAP_CHECKS_DISABLE: true
volumes:
- ${HOME}/Development/docker/sonarqube/data/:/opt/sonarqube/data
- ${HOME}/Development/docker/sonarqube/extensions/:/opt/sonarqube/extensions
- ${HOME}/Development/docker/sonarqube/logs/:/opt/sonarqube/logs
ports:
- 9000:9000
networks:
- sonarqube-network
networks:
# Create a new Docker network.
sonarqube-network:
driver: bridge
Using Docker for these tools has made my life so much easier. Now, instead of bogging down my machine with stuff I only need once in a while, I just spin things up as needed. No more unnecessary background processes, and no more cluttered dev environment.
So if your machine’s feeling the weight of too many tools, give this Docker approach a try. Hopefully, these Docker Compose files can help make your setup a little lighter and faster. Cheers!
/Users/granitebps/Development/docker/{tools_folder}/
. If you want it as is, thats fine. Just make sure folder Development/docker
is exists in your $HOME
folder.localhost
or 127.0.0.1
to host.docker.internal
. Basically, you cannot access localhost
of the host machine from docker container, so to tell docker container to used localhost
of the host machine, we changed it to host.docker.internal
.alpine
on the image name. But make sure the image have alpine
version in docker hub. Also, please note that alpine
version have less functionality than the normal version.