Skip to content

Instantly share code, notes, and snippets.

@ericreeves
Last active September 22, 2022 15:50
Show Gist options
  • Save ericreeves/02652f6c4f00173453e31de33167a40c to your computer and use it in GitHub Desktop.
Save ericreeves/02652f6c4f00173453e31de33167a40c to your computer and use it in GitHub Desktop.
docker-compose Makefile
THIS_FILE := $(lastword $(MAKEFILE_LIST))
help:
@make -pRrq -f $(THIS_FILE) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
build:
docker-compose -f docker-compose.yml build $(c)
up:
docker-compose -f docker-compose.yml up -d $(c)
start:
docker-compose -f docker-compose.yml start $(c)
down:
docker-compose -f docker-compose.yml down $(c)
destroy:
docker-compose -f docker-compose.yml down -v $(c)
stop:
docker-compose -f docker-compose.yml stop $(c)
restart:
docker-compose -f docker-compose.yml stop $(c)
docker-compose -f docker-compose.yml up -d $(c)
logs:
docker-compose -f docker-compose.yml logs --tail=100 -f $(c)
ps:
docker-compose -f docker-compose.yml ps
shell:
docker-compose -f docker-compose.yml exec $(c) /bin/bash
restart-scenario-1: destroy up
./config-1.sh
scenario-1:
./config-1.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment