-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker로 만든 이미지를 AWS를 이용해 웹 상에 배포하기 #1
Labels
documentation
Improvements or additions to documentation
Comments
AWS에서 Docker를 사용하기 편하게끔 ECS (EC2 컨테이너 서비스)라는 기능이 있는데, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
시작 전 AWS에서 발급받은 key(.pem 파일)와
Dockerfile은 경로를 통일 시키는 것을 추천한다.
(아래에서는 통일 시키지 않아서 중간에 key파일을 Dockerfile의 경로로 옮겼다.)
아래 과정은 새로운 키를 발급받아, IP주소를 받았을 때 그 주소에 ubuntu를 연결하여 실행하는 과정이다.
Docker 이미지는 사전에 만들었으므로 반복할 필요가 없다. (Dockerfile 내용 변경 시마다 이미지를 새로 구축)
<사전준비>
레파지토리 내 Dockfile 참고, 파일 위치가 중요함 (로컬 단에서 서버를 실행할 때 그 위치에 Dockfile이 있어야 함)
----------Linux 환경------------
리눅스계정명@DESKTOP-M8BFCT1:/mnt/c/Users/로컬컴퓨터사용자명$ cd /mnt/c/Users/로컬컴퓨터사용자명/Documents/crud_nodejs
발급받은 key파일과 Dockerfile이 있는 경로, 여기가 ubuntu의 시작점이다.
$ sudo ssh -i '/mnt/c/Users/로컬컴퓨터사용자명/Documents/crud_nodejs/crud_nodejs.pem' [email protected]
3.139.122.190은 AWS에서 발급받은 key에 탄력적 IP를 할당받아 고정시킨 IP이다
추후 연결이 완료되면, 모든 컴퓨터에서 해당 IP주소를 입력하면 내가 배포한 웹 서비스에 누구나 접속이 가능해진다.
만일 이 IP주소가 바뀌는 일이 생길 경우, 바뀐 IP주소로 다시 ubuntu를 연결하여 이 과정을 다시 실행해야 한다.
1 IP : 1 ubuntu 관계
----------ubuntu 환경------------
해당 ubuntu에 npm, nodejs, docker 등을 설치 중
reboot 후 ubuntu에 재접속한 뒤,
crudnodejs:crud 란 ubuntu 아닌 linux 단에서 Dockerfile이 존재하는 경로로 이동해 만들어둔 Docker 이미지명 및 태그명
bash창으로는 이미지 push가 원활하지 않아서
Docker desktop 애플리케이션에서 수동으로 push함
지금 하는 과정이 만든 이미지를 Docker hub에 push하는 과정이어서
(마치 Git hub에 push하는 과정처럼)
애플리케이션으로 해도 충분함
(ubuntu와 애플리케이션을 git bash와 source tree 같은 관계로 생각하면 편하다.)
여기까지 하면 docker hub에 올라간 이미지를, AWS key와 연결된 ubuntu 계정에 연결 완료했다
연결 완료!
3.139.122.190:3000 으로 접속하면 이제 내가 배포한 웹 사이트를 사용할 수 있다
<연결한 모습>
웹에서의 반응에 따라
ubuntu 콘솔에서 이런 식으로 뜬다
참고 글
The text was updated successfully, but these errors were encountered: