-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
88 lines (75 loc) · 2.25 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
green = "\033[32m"
default = "\033[0m"
# make 방지
.PHONY: all
all:
# app 컨테이너 생성 후, 실행
.PHONY: up
up:
@echo $(green)Executed: docker compose up -d ${container} $(default)
@docker compose up -d ${container}
# docker-compose.yml를 통해 생성된 container, network, volume 제거
.PHONY: down
down:
@echo $(green)Executed: docker compose down ${container} $(default)
@docker compose down ${container}
# docker-compose.yml를 통해 생성된 container, network, volume, image 제거
# --rmi all: down 시, 생성된 이미지 제거
.PHONY: clean
clean:
@echo $(green)Executed: docker compose down ${container} --rmi all $(default)
@docker compose down ${container} --rmi all
## docker-compose.yml를 통해 생성된 container, network, image, 모든 익명 volume 제거
## prun -f: 모든 익명 볼륨 제거
#.PHONY: fclean
#fclean:
# @echo $(green)Executed: docker compose down --rmi all -v $(default)
# @docker compose down --rmi all -v
# 입력한 서비스의 로그 출력
.PHONY: logs
logs:
@docker compose ps -a
@printf "[logs] 서비스 이름: "; \
read service; \
echo $(green)Executed: docker compose logs $$service $(default); \
docker compose logs -f $$service
# 입력한 서비스의 정보 출력
.PHONY: inspect
inspect:
@docker compose ps -a
@printf "[inspect] 서비스 이름: "; \
read service; \
echo $(green)Executed: docker inspect $$service $(default); \
docker inspect $$service | less; \
# 입력한 서비스로 접속
.PHONY: exec
exec:
@docker compose ps
@printf "[exec] 서비스 이름: "; \
read service; \
echo $(green)Executed: docker compose exec $$service /bin/bash $(default); \
docker compose exec $$service /bin/bash;\
# 모든 container, image, volume 리스트 출력
.PHONY: ps
ps:
@echo $(green)Executed: docker compose ps $(default)
@docker compose ps -a
@echo ""
@make images
@echo ""
@make volumes
# 모든 컨테이너 출력
.PHONY: containers
containers:
@echo $(green)Executed: docker volume container ls -a$(default)
@docker container ls -a
# 모든 이미지 출력
.PHONY: images
images:
@echo $(green)Executed: docker image ls -a $(default)
@docker image ls -a
# 모든 볼륨 출력
.PHONY: volumes
volumes:
@echo $(green)Executed: docker volume ls $(default)
@docker volume ls