320x100
320x100

1. 도커 허브 업로드를 위한 이미지 이름 변경
docker tag mh_main_image:0.0 2mukee/mh_main_image:1.0


2. 도커 허브로의 이미지 업로드
docker push 2mukee/mh_main_image:1.0


3. 로컬 서버 git 설치 및 docker 설치 및 세팅2
yum -y update
yum install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io
yum list docker-ce --showduplicates | sort -r
docker --version
systemctl enable docker
systemctl start docker


4. 로컬 서버 docker 환경 세팅
docker pull 2mukee/mh_main_image:1.0
docker images
docker pull centos
docker pull mongo
docker run --name mh_main_container -p 80:80 --privileged -d 2mukee/mh_main_image:1.0


5. Route53 설정
+ ip time 포트포워딩


6. 로컬서버 필요파일 세팅 (Dockerfile / mongodb-org-repo)
FROM centos
LABEL "main-server"="v0.2"
ADD mongodb-org.repo /etc/yum.repos.d/

RUN nohup yum -y update &vi 
RUN yum -y install npm git mongodb-org
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
RUN source ~/.bashrc
RUN systemctl enable mongod
RUN mkdir /usr/mh-db
RUN nohup mongod --dbpath /usr/mh-db &
WORKDIR /usr
RUN git clone https://github.com/KNUT-Mohaemookji/mohaemookji
WORKDIR /usr/mohaemookji
RUN npm -y install
WORKDIR /usr/mohaemookji/main_server

EXPOSE 17260

CMD node main_server.js -DFOREGROUND



7. docker 빌드 및 런을 위한 명령어
docker build --tag 2mukee/mh_main_image:1.0 ./ 
docker run --name mh_main_container -p 80:17260 --cap-add=NET_ADMIN --privileged -d 2mukee/mh_main_image:1.0


8. mongodb server
docker run --name mongodb -d -p 27017:27017 mongo



※ mongodb-org.repo
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc


※ vi
: gg (맨 윗 첫줄로 이동)
: Shift + v +g (전체선택)
: y (전체복사)
: d (전체삭제)
=> 비주얼 모드에서 gg > 전체선택 후 진행


Refference
https://galid1.tistory.com/324
https://growingsaja.tistory.com/126
https://docs.docker.com/engine/install/centos/
https://kgon.tistory.com/90




iptable 설정
: iptables -A INPUT -p tcp --dport 80 -j ACCEPT




아이피타임 twin ip 
https://studyforus.tistory.com/27

방화벽 해제
https://abc1211.tistory.com/289

centos 외부접속 허용
https://tlo-developer.tistory.com/130

centos 외부접속 허용2
https://jeongyd.tistory.com/22

centos7 node install
https://linuxize.com/post/how-to-install-node-js-on-centos-7/

포트의 개폐여부 확인
https://www.yougetsignal.com/tools/open-ports/

300x250
728x90