

sudo mkdir -p /home/gitlab-runner
sudo chown gitlab-runner:gitlab-runner /home/gitlab-runner

sudo gitlab-runner verify


node -e 'console.log(v8.getHeapStatistics().heap_size_limit/(1024*1024))'
// 486.75 약 486MB
export NODE_OPTIONS="--max-old-space-size=3500"

// Nginx Makefile
all:
build
build:
docker build -t my-nginx:1.25.5 .
run:
docker run -d -p 80:80 -p 443:443 --name nginx-1 \
-v /home/elice/nginx/html:/home/html \
-v /etc/letsencrypt:/etc/letsencrypt \
--network elice \
my-nginx:1.25.5
restart:
make rm
make rmi
make build
make run
rm:
docker rm -f nginx-1
rmi:
docker rmi my-nginx:1.25.5
.phony: all build run rm rmi
docker network create elice
docker network ls로 만들어진 네트워크를 확인해보면 bridge 방식으로 만들어진 걸 확인할 수 있다.docker inspect 로 어떤 게이트웨이를 지나고, 부여된 사설 네트워크를 확인할 수 있다.
"Networks": {
"elice": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"MacAddress": "02:42:ac:18:00:03",
"NetworkID": "6439216b333b04e7b53a9d7035c38d16de15c06b660d7b7465121e05796589cf",
"EndpointID": "c0f15df853b2584adb7077a56bd1935c7f11e7b33a64300200f81767bf09bdef",
"Gateway": "172.24.0.1",
"IPAddress": "172.24.0.3",
"IPPrefixLen": 16,
"Networks": {
"elice": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"MacAddress": "02:42:ac:18:00:02",
"NetworkID": "6439216b333b04e7b53a9d7035c38d16de15c06b660d7b7465121e05796589cf",
"EndpointID": "1497bfe5bd6caa46a0d88e4744ead100729fdc299bf049220c5b429732395581",
"Gateway": "172.24.0.1",
"IPAddress": "172.24.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
추가로 포트매핑 정보도 알 수 있다.
"Ports": {
"8080/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "8080"
},
{
"HostIp": "::",
"HostPort": "8080"
}
]
},
default.conf
// 기존
location /api {
proxy_pass http://localhost:8080;
}
// 변경
location /api {
proxy_pass http://spring-app:8080;
// 또는 위에서 확인한대로 도커 컨테이너가 사용중인 사설 네트워크를 입력해도 된다.
}
nginx: [emerg] host not found in upstream "spring-app" in /etc/nginx/conf.d/default.conf:40