π μμ½
μ»΄ν¨ν°λ₯Ό μ¬μ©νλ €λ©΄ μ΅μ΄ μλμ°λ₯Ό μ€μΉν΄μΌ μ¬μ©ν μ μμ.
μλμ° νλ‘κ·Έλ¨μ OS(Operating System) λΌκ³ νκ³ μ΄μ체μ λΌκ³ ν¨.
μ΄μ체μ λ ν€λ³΄λ, λ§μ°μ€, μμ
, λμμ λ±μ νκ²½μ μ½κ² μ¬μ©ν μ μκ² ν΄μ£Όλ S/W λ‘ μ΅μ΄λ‘ μ€μΉλμ΄μΌ ν¨.
μ΄μ체μ μ μ’
λ₯λ μλμ°(Window), 리λ
μ€(Linux), μ λμ€(Unix)κ° μμΌλ©° μ£Όλ‘ κ°μΈμ©μΌλ‘ μλμ°λ₯Ό μ¬μ©νκ³ νμ¬μμλ 리λ
μ€ λλ μ λμ€κ° μ¬μ©λ¨
μμ κΈ°μ :
– Basic : 리λ μ€
π κΈ°μ ꡬν
μ€ν :
- docker desktop
π 컨ν μ΄λ κ°λ°
1) μ΄λ―Έμ§ λΉλμ κ°μ
(1) λ² μ΄μ€(κΈ°λ³Έ) μ΄λ―Έμ§ μ ν
λ² μ΄μ€μ΄λ―Έμ§ : μ΄λ―Έμ§λ₯Ό λ§λ€λ λ°νμ΄ λλ(κΈ°λ³Έ) μ΄λ―Έμ§
2) 리λ μ€ s/w ν¨ν€μ§ μ ν λ° μ€μΉ
리λ μ€ λ°°ν¬ν : κ΅¬λΆ 2κ°μ§(λ°λΉμκ³μ΄(무λ£), λ λν·κ³μ΄(μμ©))
λ°λΉμ κ³μ΄ : (무λ£)ubuntu, (무λ£)μμΈλ¦¬λ μ€ λ±
μ€μΉ ν¨ν€μ§ κ΄λ¦¬μ : apt-get install ν¨ν€μ§λͺ
λ λν· κ³μ΄ : (μμ©)redhat, (무λ£)centos:7, (무λ£)rocky
μ€μΉ ν¨ν€μ§ κ΄λ¦¬μ : yum install ν¨ν€μ§λͺ
3) μ ν리μΌμ΄μ μμ© μμ€ μ½λ λ£κΈ°
(4) Dockerfile μμ±
a) λ² μ΄μ€ μ΄λ―Έμ§μ λ ν¬μ§ν 리
b) μ€μΉν ν¨ν€μ§(os μ ν μ§μ )
c) μ ν리μΌμ΄μ μ½λμ μ€μ νμΌ λ³΅μ¬
d) 컨ν μ΄λ κ°λμ λ§μ§λ§μ μ€νλ λͺ λ Ήμ΄(μ΅μ )
μμ 1) hello world μμ±λ message.txt νμΌμ΄ μμ΅λλ€.
컨ν μ΄λλ₯Ό κ°λνλ©΄ νμΌμ μ½μ΄μ νλ©΄μ μΆλ ₯νλ μ΄λ―Έμ§λ₯Ό μμ±ν΄λ³΄μΈμ.(cat /message.txt)
κ·Έλ¦¬κ³ , 컨ν μ΄λ κ°λν΄ λ³΄μΈμ
4) Dockerfile μμ± (νμΌλͺ : Dockerfile νμΌλͺ κ³ μ )
(1) OS : ubuntu:18.04 λ² μ΄μ€(κΈ°λ³Έ) μ΄λ―Έμ§ μ ν
μ¬μ©λ²) FROM λ² μ΄μ€μ΄λ―Έμ§λͺ :νκ·Έ
(2) 컨ν μ΄λ κ°λ μ 1ν μ€νν λͺ λ Ήμ΄ μ ν
μ¬μ©λ²) RUN λͺ λ Ήμ΄
μ) RUN apt-get update -y
(3) message.txt νμΌ(λ²μΈμΌλ°μ€ 리λ μ€) μ 컨ν μ΄λμμ 볡μ¬
μ¬μ©λ²) ADD νμ¬κ²½λ‘/νμΌ μ»¨ν μ΄λκ²½λ‘/νμΌ
(4) 컨ν μ΄λ κ°λ ν μ€νν λͺ λ Ήμ΄
μ¬μ©λ²) CMD λͺ λ Ήμ΄ μ΅μ νμΌλͺ
μ) CMD cat /message.txt
5) μ΄λ―Έμ§ μ μ(λΉλ)
μ¬μ©λ²) docker build –tag μμ±ν μ΄λ―Έμ§λͺ :νκ·Έ .
. : νμ¬κ²½λ‘
μ€νμ Dockerfile μλ κ²½λ‘μμ μ€νν΄μΌν¨
docker build –tag hello:latest .
D:\Work_AWS_Docker_Microservice_Step03_Docker>docker build --tag hello:latest . Sending build context to Docker daemon 5.632kB Step 1/4 : FROM ubuntu:18.04 ---> f9a80a55f492 Step 2/4 : RUN apt-get update -y ...μλ΅
6) λΉλλ(μ μλ) μ΄λ―Έμ§ hello λ₯Ό 컨ν μ΄λλ‘ μ€ννκΈ°
-it μ΅μ μλ΅
μ¬μ©λ²) docker run 컨ν μ΄λλͺ (id, λ³λͺ )
docker run hello:latest
D:\Work_AWS_Docker_Microservice_Step03_Docker>docker run hello:latest hello world D:\Work_AWS_Docker_Microservice_Step03_Docker>
7) μ°μ΅λ¬Έμ 1) μμ λ΄μ©μμ message_exam.txt μμ Hello Docker Exam μμ±νκ³ μ΄λ―Έμ§ λΉλ(μ μ) νκ³ μ»¨ν μ΄λλ₯Ό μ€νν΄μ νλ©΄μ μΆλ ₯ν΄ λ³΄μΈμ
λ¨, exam λλ ν 리λ₯Ό λ§λ€μ΄μ μμμ μμ νμΈμ
μ΄λ―Έμ§ λΉλ
μ¬μ©λ²) docker build –tag μμ±ν μ΄λ―Έμ§λͺ :νκ·Έ .
μμ±ν μ΄λ―Έμ§λͺ : hello2:latest
docker build –tag hello2:latest .
D:\Work_AWS_Docker_Microservice_Step03_Docker\exam>docker build --tag hello2:latest . Sending build context to Docker daemon 3.072kB Step 1/4 : FROM ubuntu:18.04 ---> f9a80a55f492 Step 2/4 : RUN apt-get update -y ---> Using cache ---> 723c4deb2811 ...μλ΅
8) 컨ν μ΄λ μ€ν :
docker run hello2:latest
D:\Work_AWS_Docker_Microservice_Step03_Docker>docker run hello2:latest Hello Docker Exam D:\Work_AWS_Docker_Microservice_Step03_Docker>
“03_Simple Coding – 01_develop_container” μ νλμ λ΅κΈ
I loved as much as you will receive carried
out right here. The sketch is attractive, your authored
material stylish. nonetheless, you command get got an edginess over that you wish be delivering the following.
unwell unquestionably come further formerly again since exactly the same nearly a lot often inside
case you shield this increase.
Here is my page … λ°μ΄λΈ λ°λμ΄