ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Docker for windows 10 : ๋„์ปค ๊ฐœ๋žต, windows 10 ์— ๋„์ปค ์„ค์น˜ํ•˜๊ธฐ ๋ฐฉ๋ฒ•
    PROGRAMMING/๊ธฐํƒ€ 2021. 7. 14. 23:59

    Docker ๋ž€?

    ๋„์ปค, ๋ง์€ ๊ต‰์žฅํžˆ ๋งŽ์ด ๋“ค์–ด๋ดค๋Š”๋ฐ ๋ณธ๊ฒฉ์ ์œผ๋กœ ์‚ฌ์šฉํ•ด์•ผ๊ฒ ๋‹ค, ๋ผ๊ณ  ์ƒ๊ฐํ•œ ๊ฒƒ์€ ์–ผ๋งˆ์ „ VirtualBox ๋กœ ์ž‘์—…ํ•˜๋˜ ์ค‘ ๋ถ€ํŒ…์ด ์•ˆ๋˜๋ฉฐ ๋‹ค ๋‚ ๋ผ๊ฐ”๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. (๋‹ค ๋Š” ์•„๋‹ˆ์ง€๋งŒ, ๊ท€์ฐฎ์•„์„œ ..)

    ์—ฌ๊ธฐ์— ์ƒˆ ๊ฐ€์ƒ๋จธ์‹ ์„ 8MB ์ €์žฅ๊ณต๊ฐ„์œผ๋กœ ์„ค์น˜ํ•˜๋ ค๊ณ  ํ–ˆ๋Š”๋ฐ ๋Œ€๋žต 1์‹œ๊ฐ„ ์ •๋„๊ฐ€ ๊ฑธ๋ ธ๋‹ค.

    ๊ทธ๋ž˜์„œ ๋” ๊ฐ„ํŽธํ•˜๊ณ , ๋ฐฑ์—…๋„ ๋˜๊ณ , ๊ฐ€๋ฒผ์šด Docker ์˜ ํ•„์š”์„ฑ์„ ์ ˆ๊ฐ, ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜์—ˆ๋‹ค.

     

    Docker ์— ๋Œ€ํ•ด์„œ๋Š” ๊ทธ๋ƒฅ ํฐ ๊ทธ๋ฆผ๋งŒ, ์ถ”์ƒ์ ์œผ๋กœ ์–ด๋–ค ๋Š๋‚Œ์ธ์ง€๋งŒ ์‚ดํ”ผ๊ณ  ๊ฐ€๊ฒ ๋‹ค.

    Docker ๋Š” '์ปจํ…Œ์ด๋„ˆ' ๊ธฐ๋ฐ˜์œผ๋กœ ์ž‘๋™ํ•˜๋Š”๋ฐ ์ด ์ปจํ…Œ์ด๋„ˆ์—๋Š” ์ •๋ง ์–ด๋– ํ•œ ์ด๋ฏธ์ง€๋„ ๋“ค์–ด๊ฐˆ ์ˆ˜ ์žˆ๋‹ค.

    ๊ทธ๊ฒŒ OS ๋“ , Database ๋“ ,,

     

    ์šฐ๋ฆฌ๊ฐ€ ํ”ํžˆ ์ปจํ…Œ์ด๋„ˆ๋ผ๊ณ  ์ƒ๊ฐํ•˜๋ฉด, ์•ˆ์— ๋ฌด์—‡์ด๋“  ๋„ฃ์„ ์ˆ˜ ์žˆ๋‹ค. ('์ฃผ๋จธ๋‹ˆ' ๋ผ๊ณ ๋„ ํ•  ์ˆ˜ ์žˆ๊ฒ ๋‹ค.)

    ๊ทธ๊ฒƒ์ฒ˜๋Ÿผ ์•ˆ์— ์–ด๋–ค ๊ฒƒ์ด๋“  ๋„ฃ์–ด์„œ ์ž‘๋™์‹œํ‚ฌ ์ˆ˜ ์žˆ๋‹ค๋Š” ๊ฒƒ์ด๋‹ค.

    ๊ทธ๋ž˜์„œ ์ด ๋„์ปค ์ด๋ฏธ์ง€๋ฅผ ๋งŽ์€ ์‚ฌ๋žŒ๋“ค์ด ํ™œ์šฉํ•˜๊ณ  ์žˆ๊ณ , ์ง์ ‘ ์ž์‹ ์˜ ์ด๋ฏธ์ง€๋ฅผ ๋งŒ๋“ค์–ด์„œ ๋ฐฐํฌํ•˜๋Š” ๊ฒƒ๋„ ํ™œ๋ฐœํžˆ ์ด๋ฃจ์–ด์ง€๋Š” ์ค‘์ด๋‹ค.

     

    ๋‚ด๊ฐ€ ๋„์ปค๋ฅผ ์‹œ์ž‘ํ•˜๋Š” ๋ชฉํ‘œ๊ฐ€ ๊ฐ€์ƒ๋จธ์‹ ์˜ ๋Œ€์ฒด์žฌ์˜€๋Š”๋ฐ, VMware ๋˜๋Š” VirtualBox ์—์„œ ์ƒ์„ฑํ•˜๋Š” ๊ฐ€์ƒ๋จธ์‹ ์˜ ๊ฒฝ์šฐ ํ•˜๋‚˜์˜ OS ์œ„์—์„œ ๋‹ค๋ฅธ OS ๋ฅผ ๊ฐ€์ƒํ™”ํ•ด์„œ ์‚ฌ์šฉํ•œ๋‹ค.

    ๊ธฐ๋ฐ˜์ด ๋˜๋Š” OS (Host OS) ๊ฐ€ ์šฐ๋ฆฌ๊ฐ€ ๊ฐ€์ƒ ๋จธ์‹ ์„ ๋งŒ๋“œ๋Š” ์ปดํ“จํ„ฐ์˜ OS ์ด๊ณ , ๋‚˜๊ฐ™์€ ๊ฒฝ์šฐ ์ฃผ๋กœ windows10 ์—์„œ ubuntu 18.04 ๋ฅผ ๊ฐ€์ƒํ™”ํ•ด์„œ ์‚ฌ์šฉํ•œ๋‹ค.

    ์ด๋ ‡๊ฒŒ ํ•œ OS ์œ„์— guest OS ๋ฅผ ์„ค์น˜ํ•˜์—ฌ ๋‹ค๋ฅธ OS ๋ฅผ ๊ตฌ๋™ํ•˜๋Š” ๋ฐฉ์‹์„ 'ํ˜ธ์ŠคํŠธํ˜• ๊ฐ€์ƒํ™”'๋ผ๊ณ  ํ•œ๋‹ค.

    (guest OS ๋ฅผ ์„ค์น˜ํ•˜๊ณ  ๊ตฌ๋™ํ•˜๋Š” ๊ฒƒ์ด VMware, VirtualBox ๋“ฑ์ด ์ œ๊ณตํ•˜๋Š” ๊ฒƒ์ด๋‹ค)

     

    Docker VS Vietual Machine (docs.docker.com)

    ๋ฐ˜๋ฉด ๋„์ปค๋Š” 'OS ๋ ˆ๋ฒจ ๊ฐ€์ƒํ™” ๊ธฐ๋ฒ•'์„ ์‚ฌ์šฉํ•˜์—ฌ, guest OS ์—†์ด host OS ์œ„์—์„œ ์œ ์ € ๊ณต๊ฐ„์„ ๊ฐ€์ƒํ™”ํ•œ๋‹ค.

    ์ด๋Š” ๋ณ„๋„์˜ ์ปค๋„์—์„œ ๋‘ OS ๊ฐ€ ์‹คํ–‰๋˜๋Š” ๊ฒƒ์ด ์•„๋‹Œ, Host OS ์˜ ์ปค๋„์„ ๊ณต์œ ํ•˜์—ฌ ์‹คํ–‰ํ•˜๊ฒŒ ๋˜๋ฏ€๋กœ ํ˜ธ์ŠคํŠธํ˜• ๊ฐ€์ƒํ™”๋ณด๋‹ค ์†๋„๊ฐ€ ํ›จ์”ฌ ๋น ๋ฅด๋‹ค.

     

    ๋ฌด์—‡๋ณด๋‹ค ํฐ ์žฅ์ ์€ ๋‹ค์–‘ํ•œ ๋„์ปค ์ด๋ฏธ์ง€๋ฅผ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ๊ณ , ์ž์‹ ์˜ ๋„์ปค ์ด๋ฏธ์ง€๋ฅผ ์‰ฝ๊ฒŒ ๊ณต์œ ํ•  ์ˆ˜ ์žˆ๋Š” ์ ์ด๋ผ๊ณ  ์ƒ๊ฐํ•œ๋‹ค.

     

    ๊ทธ๋Ÿผ ์ง€๊ธˆ๋ถ€ํ„ฐ Window 10 ์— ์–ด๋–ป๊ฒŒ Docker ๋ฅผ ์„ค์น˜ํ•˜๊ณ  ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์„์ง€ ์‚ดํŽด๋ณด๋„๋ก ํ•˜๊ฒ ๋‹ค.

     

     

    Windows 10 ์— Docker ์„ค์น˜ํ•˜๊ธฐ

    ์–ด๋–ค ํ”„๋กœ๊ทธ๋žจ์„ ์„ค์น˜ํ•˜๊ณ  ํ™˜๊ฒฝ ์„ค์ •์„ ํ•˜๋Š” ๋ฐ์—๋Š” (๊ทธ๋ฆฌ๊ณ  ๊ทธ ์‘์šฉ๊นŒ์ง€) ๊ณต์‹ ๋ฌธ์„œ ๋งŒํ•œ๊ฒŒ ์—†๋‹ค. ๊ณต์‹ ๋ฌธ์„œ๋ฅผ ๋ณด๋Š” ์Šต๊ด€์„ ๋“ค์ด์ž ใ…Ž

    (https://docs.docker.com/docker-for-windows/install/: docket for windows)

     

    ์œ„์˜ ์‚ฌ์ดํŠธ๋ฅผ ์ฐธ๊ณ ํ•˜์—ฌ Windows 10 ์— Docket Desktop ์„ ์„ค์น˜ํ•˜์˜€๋‹ค.

     

    ๋‹ค๋งŒ, ๋ชจ๋“  Windows 10 ์ด Docker Desktop ์„ ์ง€์›ํ•˜๋Š” ๊ฒƒ์€ ์•„๋‹ˆ๊ณ , ๋‹ค์Œ์˜ 2 ๊ฐ€์ง€ ์‚ฌํ•ญ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” OS ์—ฌ์•ผ ํ•œ๋‹ค.

    • WSL 2 backend
    • Hyper-V backend and Windows Conainers

     

    ๋’ค ์‚ฌํ•ญ์„ ๋งŒ์กฑํ•˜๋Š” PC ๋ผ๋ฉด, ์ด์ œ ์„ค์น˜๋ฅผ ์‹œ์ž‘ํ•ด๋ณด์ž. (๋งŒ์•ฝ ์ง€์›ํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด, Linux ๋กœ ๋„์ปค๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ๊ณ ๋ คํ•ด์•ผ ํ•œ๋‹ค.- ์ฐธ๊ณ  https://subicura.com/2017/01/19/docker-guide-for-beginners-2.html)

     

    Hyper-V ํ™œ์„ฑํ™”

    ๋จผ์ € Hyper-V ๋ฅผ ์‚ฌ์šฉ ์ค‘์ธ์ง€ ํ™•์ธํ•ด๋ณด์ž.

    ์ž‘์—… ๊ด€๋ฆฌ์ž - ์„ฑ๋Šฅ์—์„œ ๊ฐ€์ƒํ™”๊ฐ€ '์‚ฌ์šฉ' ์œผ๋กœ ๋˜์–ด์žˆ๋Š”์ง€, ๋˜๋Š” PowerShell ์—์„œ systeminfo | find "Hyper" ์ž…๋ ฅ ์‹œ Hyper-V ๊ฐ€ ๋‚˜์˜จ๋‹ค๋ฉด ์‚ฌ์šฉ๊ฐ€๋Šฅํ•˜๋‹ค๋Š” ๊ฒƒ์ด๋‹ค.

    ์ž‘์—…๊ด€๋ฆฌ์ž - ์„ฑ๋Šฅ
    systeminfo find "Hyper"

    ๋งŒ์•ฝ ์‚ฌ์šฉ์ค‘์ด ์•„๋‹ˆ๋ผ๋ฉด, MicroSoft ๊ฐ€ ์ œ๊ณตํ•˜๋Š” ๋ฐฉ๋ฒ•์œผ๋กœ ํ•ด๊ฒฐํ•˜๋ฉด ๋œ๋‹ค!

    (https://docs.microsoft.com/ko-kr/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v)

    docs.microsoft.com

    Instll WSL 2

    (https://docs.microsoft.com/en-us/windows/wsl/install-win10: Install WSL & update WSL 2)

     

    ์ด์   WSL 2 ๋ฅผ ์„ค์น˜ํ•ด๋ณด์ž.

    PowerShell ์„ ์—ด๊ณ , ๋‹ค์Œ ๋‹จ๊ณ„๋ฅผ ๋”ฐ๋ผ๊ฐ€๋ณด์ž.

     

    Step 1) Windows ์— Linux ๊ด€๋ จ์„ ์„ค์น˜ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” "Windows Subsystem for Linux" ๋ฅผ ํ™œ์„ฑํ™”์‹œ์ผœ์•ผ ํ•œ๋‹ค.

    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

    (PowerShell ์— ์ž…๋ ฅ)

     

    Step 2) Virtual Machine Platform ์„ ํ™œ์„ฑํ™”ํ•œ๋‹ค.

    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

    (PowerShell ์— ์ž…๋ ฅ)

     

    Step 1 & Step 2

    Step 3) Linux Kernel update package ๋ฅผ ๋‹ค์šด๋ฐ›๋Š”๋‹ค.

    (2021 07 19 ๊ธฐ์ค€, ์ตœ์‹  ๋ฒ„์ „ ๋‹ค์šด ๋งํฌ: https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi)

    ๋งŒ์•ฝ x64 ๊ฐ€ ์•„๋‹Œ ARM64 ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” PC ๋ผ๋ฉด, ARM64 Package (https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_arm64.msi) ๋ฅผ ๋‹ค์šด๋ฐ›์•„์•ผ ํ•œ๋‹ค.

     

    x64 ์™€ ARM 64 ํ™•์ธ ๋ฐฉ๋ฒ•!

    ๋”๋ณด๊ธฐ

    PowerShell ์—์„œ systeminfo | find "์‹œ์Šคํ…œ ์ข…๋ฅ˜" ๋ฅผ ์ž…๋ ฅํ•ด์ฃผ๋ฉด, ํ•ด๋‹น ์ •๋ณด๋ฅผ ์•Œ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

     

    ํŒŒ์ผ์„ ์ž˜ ๋‹ค์šด๋ฐ›์•˜์œผ๋ฉด, ๋‹ค์šด๋ฐ›์€ ํŒŒ์ผ์„ ์‹คํ–‰ํ•˜์—ฌ ์•ˆ๋‚ด์— ๋”ฐ๋ผ ์„ค์น˜ํ•˜๋ฉด ๋œ๋‹ค.

    WSL 2 ์„ค์น˜ (x64)

     

    ์„ค์น˜ ํ›„์—๋Š” ์ด์ œ Docker Desktop ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋œ๋‹ค!

     

    Install Docker Desktop

    https://docs.docker.com/docker-for-windows/install/ ์˜ ๋‹ค์Œ ํŒŒ๋ž€ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด, ์„ค์น˜ ํŒŒ์ผ์„ ๋‹ค์šด๋ฐ›์„ ์ˆ˜ ์žˆ๋‹ค.

    (https://desktop.docker.com/win/stable/amd64/Docker%20Desktop%20Installer.exe)

     

    ๋‹ค์šด๋ฐ›์€ ํŒŒ์ผ์„ ์‹คํ–‰ํ•˜์—ฌ ์•ˆ๋‚ด์— ๋”ฐ๋ผ ์„ค์น˜ํ•˜๋ฉด ๋œ๋‹ค.

    https://docs.docker.com/docker-for-windows/install/

    ๊ทธ๋Ÿผ Docker Desktop ์„ ์‹คํ–‰ํ•˜์—ฌ ๋„์ปค๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

     

    ์ž˜ ์„ค์น˜๋๋Š”์ง€๋Š” docker version ์„ PowerShell ์— ์ž…๋ ฅํ•˜๋ฉด ์•Œ ์ˆ˜ ์žˆ๋‹ค.

     

    WSL2 Error

    WSL(windows Subsystem for Linux 2) ๊ฐ€ ์„ค์น˜๋˜์ง€ ์•Š์•˜๋‹ค๋Š” ์˜ค๋ฅ˜๊ฐ€ ๋œจ๊ธฐ๋„ ํ•œ๋‹ค.

    WSL2 ๋ฅผ ์„ฑ๊ณต์ ์œผ๋กœ ์„ค์น˜ํ•˜์ง€ ์•Š์•˜๊ฑฐ๋‚˜, ์•„์˜ˆ ์„ค์น˜ํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ์ด๋‹ค.

    Microsoft ์˜ ๊ณต์‹ ๋ฌธ์„œ https://docs.microsoft.com/en-us/windows/wsl/install-win10 ์„ ๋ณด๊ณ  ๋”ฐ๋ผ๊ฐ€์ž.

     

     

     

    ์œ„์˜ Install WSL 2 ๋ฅผ ๋”ฐ๋ผ์„œ WSL 2 ๋ฅผ ์ž˜ ์„ค์น˜ํ•˜๋ฉด ๋œ๋‹ค.

    WSL 2 ์„ค์น˜ ํ›„์—๋Š” PC ๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ•ด์•ผ ํ•œ๋‹ค.

     

    Windows 10 '์ข…๋ฃŒ' ํ•˜๊ธฐ

    ๋‹จ, Windows 10 ์˜ ๊ฒฝ์šฐ windows ๋ฒ„ํŠผ -> ๋‹ค์‹œ ์‹œ์ž‘ ์ด ์™„์ „ํžˆ ์ „์›์„ ๋„๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ๋‹ค์Œ์˜ ๋‘ ๋ฐฉ๋ฒ• ์ค‘ ํ•˜๋‚˜ (ํ˜น์€ ๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์ด ์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค) ๋ฅผ ์„ ํƒํ•ด์„œ '์ข…๋ฃŒ' ํ•ด์ฃผ์ž.

    • ์ž‘์—… ๊ด€๋ฆฌ์ž์—์„œ ํŒŒ์ผ - ์ƒˆ ์ž‘์—…์œผ๋กœ shutdown -s -t 0 ์„ ์ž…๋ ฅํ•˜์—ฌ ์‹คํ–‰ํ•˜๊ฑฐ๋‚˜,
    • shift ํ‚ค๋ฅผ ๋ˆ„๋ฅธ ์ƒํƒœ์—์„œ '๋‹ค์‹œ ์‹œ์ž‘' ์„ ๋ˆ„๋ฅด๊ณ  ๊ธฐ๋‹ค๋ฆฌ๋ฉด ์ „์› ๋„๋Š” ๋ฒ„ํŠผ์ด ์ƒˆ๋กœ ๋‚˜์˜จ๋‹ค. ๊ทธ๊ฑธ ๋ˆ„๋ฅด๋ฉด ๋“œ๋””์–ด '์ข…๋ฃŒ'๊ฐ€ ๋œ๋‹ค.

    ๋Œ“๊ธ€

Designed by Tistory.