2023. 8. 14. 03:18ㆍ도커
EC2 인스턴스를 ubuntu 로 생성한다.
https://muyeon95.tistory.com/187
AWS EC2 배포하기
선행작업 https://muyeon95.tistory.com/186 github SSH Repository [ git ] - 우선 repository 를 생성한다. - SSH 키를 발급받는다. 생성한 repository 를 사용하기 위해서 로컬환경에서 깃허브를 사용하기 위해 인증을
muyeon95.tistory.com
Dockerfile
FROM node:18-buster
WORKDIR /app
COPY . .
RUN npm i
RUN npm i pm2 -g
RUN npm run build
RUN npm run migration:run
EXPOSE 8080
COPY .env /app/dist
ENTRYPOINT ["pm2-runtime", "start", "/app/dist/main.js", "-i", "max"]
docker-compose
version: '3'
services:
postgresql:
image: postgres
restart: always
container_name: postgres
ports:
- '5432:5432'
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: password
volumes:
- ./data/postgres/:/var/lib/postgresql/data
도커 허브 배포
docker build -f Dockerfile -t <이름> .
위 명령어가 안된다면 아래링크
https://muyeon95.tistory.com/254
WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64/v3) and no speci
도커 허브를 배포하는중에 발생했던 문제이다. 아래는 수행했던 명령어이다. docker build -f Dockerfile -t . docker images docker run -d -p 8080:8080 docker ps docker stop [컨테이너_ID 또는 이름] docker tag ticketnest:late
muyeon95.tistory.com
docker build --platform linux/amd64 -f Dockerfile -t ticketnest .
docker images
docker run -d -p 8080:8080 ticketnest
docker ps
docker stop <컨테이너 ID 또는 이름>
docker tag ticketnest:latest munyeolyoon/ticketnest:latest
// docker tage <이미지 이름:태그 바꿀이름:태그>
docker push munyeolyoon/ticketnest
// docker push <계정명/레포지토리명>
EC2 ubuntu 세팅
sudo docker pull munyeolyoon/ticketnest:latest
sudo docker images
sudo docker run --name ticketnest -d -p 8080:8080 munyeolyoon/ticketnest:latest
RDS 인바운드 규칙을 세팅하고 브라우저로 접속해본다.
만약 브라우저에 접속했을때 bcrypt 관련 에러가 난다면?
https://muyeon95.tistory.com/255
Error: /app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node: invalid ELF header
Nest.js 를 EC2 도커 인스턴스 환경에서 사용하려고 했을때 발생했던 오류이다. 에러 코드 Error: /app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node: invalid ELF header at Object.Module._extensions..node (node:internal/mo
muyeon95.tistory.com
또는 RDS 와 연결이 안된다면 아래 링크를 참고
https://muyeon95.tistory.com/256
[Nest] 35 - 08/12/2023, 3:47:41 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...Error: connect ETI
문제 상황 EC2 인스턴스에 nest.js 앱과 rds 를 연결하던 중 발생했던 오류이다. [Nest] 35 - 08/12/2023, 3:47:41 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)... Error: connect ETIMEDOUT at TCPConnectWrap.afte
muyeon95.tistory.com
참고 링크
(Docker)도커 - (Docker Hub) 도커 허브 사이트에 저장(push) 및 가져오기(pull)
(Docker)도커 - (Docker Hub) 도커 허브 사이트에 저장(push) 및 가져오기(pull) 도커 이미지를 저장하고, 다른 호스트에서 가져다가 사용하는 방법에는 3가지 방법이 있습니다. docker save 명령어로 저장 및
reddb.tistory.com
'도커' 카테고리의 다른 글
ubuntu Docker compose 설치 (0) | 2023.08.14 |
---|---|
ubuntu Docker 설치 (0) | 2023.08.14 |
EC2 ubuntu 인스턴스에 Docker 설치하고 app 띄우기 (0) | 2023.08.13 |
Docker nGrinder 사용 (0) | 2023.08.13 |
ubuntu 도커 백그라운드 실행 & 로그 명령어 (0) | 2023.08.10 |