공부계기
1. 백기선님 유튜브보다가 백엔드 필수기술로 도커/쿠버네티스와같은 컨테이너환경과 확실히 잘하는 언어 1개를 언급
2. 모 증권사 프로젝트 도중 인접파트의 기술로 접하면서 호기심 생겼음.
3. 현재 멘토링 프로젝트 요구사항으로 도커를 접목하라고 하심.
실습환경
선택지는 3개인데 3번으로 진행.
1.윈도우 환경이라서 wsl2기반의 dockerDesktop설치도중 윈도우설치파일들과 충돌문제로 계속포맷해야 하는 상황이 옴.(cpu가상화설정이 안되어서 그런거같음.[집에있는데스크톱으로는 가상화설정걸어주는 잘되었음. ])
2. virtualBox도 괜찮지만 포맷되어서 다시 세팅해줘야 함. >> 시간 촉박.
3. 기존에 내가 가지고 있는 awsLightSail로 진행하기로 함. 근데 추후 진행하면서 메모리가 달려서 인스턴스 업그레이드를 했음. 쓸모없는 예산이 들어가기는 한 거지만 공부라 생각하기로 함.
개념
어플리케이션 컨테이너. os수준의 가상화, 가상화프로그램은 다양. hypervisor,kvm 등등
MSA의 대두로 필수 인프라기술. (쿠버네티스는 컨테이너를 orchestration하는 도구 , k8s라고도 함. )
docker의 근반 기술은 chroot, cgroups,namespace
도커는 guest OS의 커널을 공유하는 것이기에 장점이 virtualBOX류보다 확실.
ex) 경량, 속도, 편의성.
2013년 기술.
설치중 문제
도커 푸쉬 안되는 경우.
1. 로그인안한경우.
2. Docker Tag 를 Docker Hub ID 와 동일하게
아키텍처
명령어
docker images
docker push
docker login
docker tag
docker image tag ubuntu:18.04 jws1837/dbgurum:18.04
docker pull
docker run -it busybox sh
도커 파일시스템 구조
Deep Dive into Docker Internals - Union Filesystem | Martin Heinz | Personal Website & Blog
공식문서 - https://docs.docker.com/
What is Union Filesystem?
why?
Many images that we use to spin up our containers are quite bulky whether it's ubuntu with size of 72MB or nginx with size of 133MB. It would be quite expensive to allocate that much space every time we'd like to create a container from these images. Thanks to union filesystem, Docker only needs to create thin layer on top of the image and rest of it can be shared between all the containers. This also provides the added benefit of reduced start time, as there's no need to copy the image files and data.
Union filesystem also provides isolation, because containers have read-only access to the shared image layers. If they ever need to modify any of the read-only shared files, they use copy-on-write strategy (discussed little later) to copy the content up to their top writable layer where it can be safely modified.
How Does It Work?
non-container case로 생각해보고, 테스트.
let's imagine that we would like to union mount two directories (upper and lower) onto same mount point and have a unioned view of them:
mount 명령어 숙달 필요
ㄱ
168. [Linux] 투명 셀로판지 이론을 .. : 네이버블로그 (naver.com)
컨테이너
이미지레이어(lowerdir)+읽고쓰기가능한 레이어(upperdir)
컨테이너는 결국 프로세스다.
이미지 명령어와 마찬가지로 dockerd데몬이 제공하는 dockerCLI API를 통해 제공
컨테이너 관련 명령어
실행 및 종료: run(사실 create-start-attach가 포함되어있음. )으로 하면 간단하다.
$ docker run -it --name container-test1 ubuntu:18.04 bash
$ exit
$ docker rm container-test1
docker run = [pull] + create + start + [command]
'docker' 카테고리의 다른 글
docker-compose (0) | 2022.05.02 |
---|---|
docker(3) - 컨테이너 리소스 제약. (0) | 2022.05.02 |
docker(2) - 데이터관리 (필수옵션 볼륨) "run -v" (작성중) (0) | 2022.05.02 |