yum repolist
yum install -y yum-utils
# --config-manager 사용하기 위한 패키지 설치
yum-config-manager --add-repo \
> https://download.docker.com/linux/centos/docker-ce.repo
# repository 추가
yum install docker-ce docker-ce-cli containerd.io -y
# docker 설치
systemctl start docker
# docker 실행
systemctl enable docker
# reboot해도 유지되게 enable(활성화)
systemctl status docker
# docker 엔진 상태 확인
2-4) Docker Container Run
docker build -t tmkube/hello .
-t : 레파지토리/이미지명:버전
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
somaz94/hello latest 360e02156cdb 5 weeks ago 248MB
kubetm/hello latest 360e02156cdb 5 weeks ago 248MB
node slim 99defcfc3a10 6 weeks ago 248MB
tmkube/hello latest e5137372eeab 3 years ago 150MB
docker run -d -p 8100:8000 tmkube/hello
-d : 백그라운드 모드
-p : 포트변경
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c589216cc396 tmkube/hello "docker-entrypoint.s…" 4 minutes ago Up 4 minutes 0.0.0.0:8100->8000/tcp, :::8100->8000/tcp eager_hamilton
docker exec -it c589216cc396 /bin/bash
# 동일하게 터널링으로 확인
ssh -p [포트번호] -L localhost:9999:192.168.21.112:8100 [server id]@[server ip]
2-5) Docker Image Push
docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: somaz94
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
docker push somaz94/hello
Using default tag: latest
The push refers to repository [docker.io/somaz94/hello]
2fa21bb903cd: Pushed
91664b9ef030: Mounted from library/node
ccfc9c391c3f: Mounted from library/node
9ae1f99bd2f3: Mounted from library/node
fe5ae6be2231: Mounted from library/node
43b3c4e3001c: Mounted from library/node
latest: digest: sha256:e93ba9dcd7e9f41b988f9adb9319ba429de978a9136371df5b860328198031df size: 1574