Day 46 Docker(1)

๐Ÿ“‹ย ๊ณต๋ถ€ ๋‚ด์šฉ

์‹ค์Šต

  1. ๋กœ์ปฌ์—์„œ ์ด๋ฏธ์ง€ ๋นŒ๋“œ

  2. Docker Hub์— push

  3. ๋‹ค๋ฅธ ์„œ๋ฒ„์—์„œ ๋‹ค์šด๋กœ๋“œ ํ•˜์—ฌ ์‹คํ–‰

  • docker๊ฐ€ ์„ค์น˜๋˜์–ด์žˆ๋Š” ์„œ๋ฒ„๋ฅผ 4์‹œ๊ฐ„๋™์•ˆ ์ œ๊ณตํ•ด์ฃผ๋Š” ์‚ฌ์ดํŠธ

๐Ÿ‘€ย CHECK

(์–ด๋ ต๊ฑฐ๋‚˜ ์ƒˆ๋กญ๊ฒŒ ์•Œ๊ฒŒ ๋œ ๊ฒƒ ๋“ฑ ๋‹ค์‹œ ํ™•์ธํ•  ๊ฒƒ๋“ค)

Install docker desktop on Ubuntu server

์„œ๋ฒ„ ์‚ฌ์–‘

  • Google Cloud Compute Engine
  • ๋จธ์‹  : n1-standard-4
    • 4 vCPUs, 2 cores, 15GB memory
  • ๋ถ€ํŒ… ๋””์Šคํฌ
    • Ubuntu 22.04 LTS
    • SSD 64GB

์„ค์น˜ ๊ณผ์ •

  1. root ์œ ์ €๋กœ ๋กœ๊ทธ์ธ

    1
    
    sudo su
    
  2. install docker engine ๋งํฌ ์ฐธ๊ณ 

  3. DEB package ๋‹ค์šด๋กœ๋“œ

    1
    2
    3
    
    curl -O https://desktop.docker.com/linux/main/amd64/docker-desktop-4.26.1-amd64.deb?utm_source=docker&utm_medium=webreferral&utm_campaign=docs-driven-download-linux-amd64
    # ํŒŒ์ผ ์ด๋ฆ„์— ์ฟผ๋ฆฌ๊ฐ€ ๋ถ™์–ด์„œ ์ด์ƒํ•ด์ง„ ๊ฒฝ์šฐ์— ์ด๋ฆ„ ๋ณ€๊ฒฝ ํ•„์š”ํ•จ
    mv docker-desktop-4.26.1-amd64.deb\?utm_source\=docker docker-desktop-4.26.1-amd64.deb
    
  4. ํŒจํ‚ค์ง€ ์„ค์น˜ ๋งํฌ ์ฐธ๊ณ 

    1
    
    sudo apt-get install ./docker-desktop-4.26.1-amd64.deb
    
  5. ์ผ๋ฐ˜ ์œ ์ €๋กœ ๋น ์ ธ๋‚˜์™€์„œ ๋„์ปค ๊ถŒํ•œ์„ค์ • ๋ฐ ์„œ๋น„์Šค ์‹คํ–‰

    1
    2
    3
    
    exit
    sudo usermod -aG docker ${USER}
    systemctl --user start docker-desktop
    
  6. Headless ํ™˜๊ฒฝ์—์„œ docker desktop์„ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋„๋ก ์„ค์ •

    • Headless server : GUI ํ™˜๊ฒฝ์ด ์กด์žฌํ•˜์ง€ ์•Š๋Š”, User Interaction ๊ธฐ๊ธฐ๊ฐ€ ์—†๋Š”? ๊ทธ๋Ÿฐ ์„œ๋ฒ„
    • ubuntu desktop์„ ์„ค์น˜ํ•˜๋ฉด ๋” ํŽธํ•˜์ง€๋งŒ, ๊ทธ๋ ‡๊ฒŒ ํ•˜์ง€ ์•Š๊ณ  ๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์ด ์žˆ๋‹ค๋ฉด ๊ทธ๊ฑธ๋กœ ์ง„ํ–‰ํ•ด๋ณด๊ณ  ์‹ถ์—ˆ์Œ
    • ํฌ๋กฌ ์›๊ฒฉ ๋ฐ์Šคํฌํƒ‘์„ ์„ค์น˜ํ•˜๊ณ  ์„ค์ •ํ•˜์—ฌ ์—ฐ๊ฒฐ ์ง„ํ–‰
    • ์ฐธ๊ณ ๋งํฌ
  7. xfce4 ์„ค์น˜

    • ๋ฆฌ๋ˆ…์Šค ๋ฐ ์œ ๋‹‰์Šค ๊ณ„์—ด ์šด์˜ ์ฒด์ œ๋ฅผ ์œ„ํ•œ ๊ฐ€๋ฒผ์šด ๋ฐ์Šคํฌํƒ‘ ํ™˜๊ฒฝ
    1
    
    sudo apt-get install xfce4
    
  8. ํฌ๋กฌ ์„ค์น˜

    1
    2
    
    wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
    sudo apt install ./google-chrome-stable_current_amd64.deb
    
  9. ํฌ๋กฌ ๋ฐ์Šคํฌํƒ‘ ์„ค์น˜ ๋ฐ ์„ค์ •

    1
    2
    
    wget https://dl.google.com/linux/direct/chrome-remote-desktop_current_amd64.deb
    sudo apt install ./chrome-remote-desktop_current_amd64.deb
    
    • ์„ค์ •
    1
    
    vi ~/.chrome-remote-desktop-session
    
    • ํŒŒ์ผ์— ๋‹ค์Œ ์ถ”๊ฐ€
    1
    
    exec /usr/bin/xfce4-session
    
    • ํฌ๋กฌ ์›๊ฒฉ ๋ฐ์Šคํฌํƒ‘ ์„œ๋น„์Šค ์‹คํ–‰
    1
    
    systemctl restart chrome-remote-desktop@$USER
    
  10. ํฌ๋กฌ ์›๊ฒฉ ๋ฐ์Šคํฌํƒ‘ ํ˜ธ์ŠคํŠธ ์‹คํ–‰ ๋ฐ ์—ฐ๊ฒฐ

  • ์‹คํ–‰
1
DISPLAY= /opt/google/chrome-remote-desktop/start-host --code="4/0AfJohXmJq9WTMUqer6hYc5SHvw2-HH8XJBktdLdjEwjjqfTzxDb-Hnkh7XsTWVWintaZ7A" --redirect-url="https://remotedesktop.google.com/_/oauthredirect" --name=$(hostname)
  • ์˜ค๋ฅ˜ ๋ฐœ์ƒ

    [1218/052045.042357:ERROR:host_config.cc(83)] Failed to read /home/sarah/.config/chrome-remote-desktop/host#6d661ddc3145c41c372a1cce192c59c2.json

  • ๊ถŒํ•œ ์ฃผ๊ณ  ์žฌ์‹คํ–‰

1
2
3
sudo chown -R sarah:sarah /home/sarah/.config/chrome-remote-desktop
sudo chmod -R 755 /home/sarah/.config/chrome-remote-desktop
systemctl --user restart chrome-remote-desktop
  1. VM ๋จธ์‹  ์œ„์—์„  docker desktop์€ ์•ˆ๋˜๋Š” ๊ฒƒ ๊ฐ™์Œ
  • ํฌ๊ธฐํ•˜๊ณ  docker-desktop ์‚ญ์ œํ•จ (ใ… )
  • ubuntu-desktop์€ ํ˜น์‹œ ๋ชฐ๋ผ์„œ ๋‚จ๊ฒจ๋‘ 
  1. nested vm ์„ค์ •ํ•˜๋ฉด ๋œ๋‹ค๋Š” ๋ง์ด ์žˆ์–ด์„œ ์‹œ๋„ํ•ด๋ด„ ์ฐธ๊ณ  ๋งํฌ
  • e2๋จธ์‹ ์€ ์„ค์ •์ด ์•ˆ๋ผ์„œ n1, n2 ์ค‘ ๋น„์Šทํ•œ ์‚ฌ์–‘์œผ๋กœ ๊ณจ๋ผ์„œ ์ง„ํ–‰

  1. ์„ฑ๊ณต!
  • killall -3 gnome-shell ์œผ๋กœ ์‹คํ–‰ํ–ˆ์„ ๋•Œ activities ํ™œ์„ฑํ™” ๋œ ์ƒํƒœ๋กœ ๊ฐ–ํ˜€์žˆ๊ฒŒ๋˜๋Š” ๋ฌธ์ œ ํ•ด๊ฒฐ
  • overview ์•ˆ๋œจ๊ฒŒ ํ•˜๋Š” extension ์„ค์น˜

โ— ๋Š๋‚€ ์ 

๋„์ปค๋ฅผ ๋กœ์ปฌ์—์„œ ๋Œ๋ฆฌ๊ธฐ ์–ด๋ ค์šด ํ™˜๊ฒฝ์ด๋ผ, ์ด์ฐธ์— ๋„์ปค๋ฅผ ์„ค์น˜ํ•œ ์„œ๋ฒ„๋ฅผ ๋งŒ๋“ค์–ด์„œ ์šด์˜ํ•˜์ž๋Š” ์ƒ๊ฐ์„ ํ•˜๊ณ  ์žˆ์—ˆ๋‹ค.

์ฒ˜์Œ์—๋Š” ์„œ๋ฒ„์— docker๋งŒ ์„ค์น˜ํ•ด์„œ ์ง„ํ–‰ ํ•  ์˜ˆ์ •์ด์—ˆ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ Ubuntu 22.04 ์ด์ƒ๋ถ€ํ„ฐ docker desktop์„ ์ง€์›ํ•œ๋‹ค๋Š” ์‚ฌ์‹ค์„ ์•Œ๊ฒŒ ๋˜์—ˆ๊ณ , GUIํ™˜๊ฒฝ์„ ๊ตฌ์„ฑํ•ด์„œ docker desktop ํ”„๋กœ๊ทธ๋žจ์œผ๋กœ ๋„์›Œ๋ณด๊ณ ์‹ถ์€ ์š•๋ง(ใ…‹ใ…‹)์ด ์ƒ๊ฒผ๋‹ค.

์ฝ”์–ดํƒ€์ž„ 6์‹œ๊ฐ„ ์ค‘ 5์‹œ๊ฐ„ ์ด์ƒ์„ ์„œ๋ฒ„ ์„ค์ •ํ•˜๊ณ  ์„ค์น˜ํ•˜๋Š”๋ฐ ์†Œ๋ชจํ–ˆ๋Š”๋ฐ, ์—ฌ๋Ÿฌ ์‹œํ–‰์ฐฉ์˜ค๋ฅผ ๊ฑฐ์ณค์ง€๋งŒ ๊ฒฐ๊ตญ ์„ฑ๊ณตํ–ˆ๋‹ค๋Š”๊ฒŒ ๋„ˆ๋ฌด ๋ฟŒ๋“ฏํ•˜๊ณ  ๊ธฐ๋ถ„์ด ์ข‹์•˜๋‹ค.

kvm์ง€์›์—ฌ๋ถ€๋ฅผ ๋จผ์ € ํ™•์ธํ–ˆ๋‹ค๋ฉด ์ฐธ ์ข‹์•˜์„ํ…๋ฐ… ๊ทธ๋žฌ๋‹ค๋ฉด xfce4๋ฅผ ์„ค์น˜ํ–ˆ๋‹ค ์ง€์› ๋‹ค ๋‚œ๋ฆฌ์น˜๊ณ  ๊ทธ๋Ÿด ์ผ๋„ ์—†์—ˆ์„ํ…๋ฐ… ์ฐธ ์•„์‰ฝ์ง€๋งŒ ๋„์ปค ๋ฐ์Šคํฌํƒ‘์ด ์•ˆ๋˜๋˜ ์ด์œ ๋ฅผ ์•Œ๊ณ , nested visualization์„ ์ง€์›ํ•˜๋Š” ๋จธ์‹ ์œผ๋กœ ๊ต์ฒดํ•œ ํ›„ ๊ฑฐ์ง“๋ง์ฒ˜๋Ÿผ ์„ฑ๊ณตํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— ์žŠ์œผ๋ ค๊ณ  ํ•œ๋‹ค.. (ใ… ใ… )

์ด ๊ณผ์ • ๋ฐ airflow ์„œ๋ฒ„ ๊ตฌ์„ฑ ๊ณผ์ •๋„ ์ •๋ฆฌํ•ด์„œ ๋ธ”๋กœ๊ทธ์— ๊ธ€์„ ์˜ฌ๋ ค๋ณผ๊นŒ ํ•œ๋‹ค. ๋ˆ„๊ตฐ๊ฐ€์—๊ฒ ๋„์›€์ด ๋˜๊ฒ ์ง€ ^^

Hugo๋กœ ๋งŒ๋“ฆ
Jimmy์˜ Stack ํ…Œ๋งˆ ์‚ฌ์šฉ ์ค‘