Skip to content

Instantly share code, notes, and snippets.

@youngsoul
Created August 22, 2021 19:57
Show Gist options
  • Select an option

  • Save youngsoul/aa2861ae7458d17a0a5b909666681a83 to your computer and use it in GitHub Desktop.

Select an option

Save youngsoul/aa2861ae7458d17a0a5b909666681a83 to your computer and use it in GitHub Desktop.
Makefile to help with postgres docker commands
# Containers ids
postgres-id=$(shell docker ps -a -q -f "name=postgres-container")
# Stop docker containers
stop-all:
@docker-compose stop
stop-db:
-@docker stop $(postgres-id)
# Remove docker containers
rm-postgres:
-@docker rm $(postgres-id)
# Run docker containers
run:
@docker-compose -f docker-compose.yml up
run-db:
@docker-compose -f docker-compose.yml up db
shell-postgres:
@docker exec -it $(postgres-id) bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment