[Ubuntu 20.04] Docker ์„ค์น˜ ๋ฐ Portainer ๊ตฌ์ถ•

2021. 7. 14. 02:09ใ†System ์ž‘์—…์‹ค/LINUX

728x90
๋ฐ˜์‘ํ˜•

์•ˆ๋…•ํ•˜์„ธ์š”? ์ฃผ๋‹ˆํ•˜๋ž‘ ์ž…๋‹ˆ๋‹ค.

์˜ค๋Š˜์€  Ubuntu 20.04์— Docker๋ฅผ ์„ค์น˜ ํ•ด ๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

๋ฐ”๋กœ ์‹œ์ž‘ ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค!

 


 

โœ” ๋ชฉ์ฐจ

VMWare๋ฅผ ํ†ตํ•œ Ubuntu 20.04 LTS ์„ค์น˜

Docker์™€ Portainer ์„ค์น˜

Portainer๋ฅผ ์ด์šฉํ•œ nginx ์„ค์น˜

[docker] Portainer๋ฅผ ์ด์šฉํ•œ tomcat ์„ค์น˜

 

๐Ÿ“Œ Docker๋ž€?


     ๐Ÿ“ Docker๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ์ด์œ 

Docker๋Š” ์–ด๋– ํ•œ ํ”„๋กœ๊ทธ๋žจ์„ ๋‹ค์šด ๋ฐ›๋Š” ๊ณผ์ •์„ ๊ต‰์žฅํžˆ ๊ฐ„๋‹จํ•˜๊ฒŒ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด์„œ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด์—์š”.

์šฐ๋ฆฌ๊ฐ€ ์–ด๋–ค ํ”„๋กœ๊ทธ๋žจ์„ PC์— ์„ค์น˜ํ•˜๋ ค๋ฉด ์œ„์™€ ๊ฐ™์€ ๊ณผ์ •์„ ๊ฑฐ์น˜๊ฒŒ ๋˜๋Š” ๊ฒƒ์ด์—์š”.

ํ•˜์ง€๋งŒ ์šฐ๋ฆฌ๋Š” ์—ฌ๋Ÿฌ ์ƒํ™ฉ๊ณผ ํ™˜๊ฒฝ์œผ๋กœ ์ธํ•ด ์•„๋ž˜ ์ฒ˜๋Ÿผ Error๋ฅผ ๋งŒ๋‚˜๊ฒŒ ๋  ์ˆ˜๋„ ์žˆ๋‹ต๋‹ˆ๋‹ค.

 Error๊ฐ€ ๋ฐœ์ƒํ•˜๋Š” ์ด์œ ๋Š” ์šฐ๋ฆฌ์˜ PC, Package Version, Operation System ๋“ฑ๋“ฑ์— ๋”ฐ๋ผ ํ•ด๋‹น ํ”„๋กœ๊ทธ๋žจ์„ ์„ค์น˜ํ•˜๋Š” ๊ณผ์ •์—์„œ ๋งŽ์€ Error๊ฐ€ ๋ฐœ์ƒํ•˜๋Š” ๊ฒƒ์ด์—์š”. ๋˜ํ•œ, ์œ„์™€ ๊ฐ™์€ ๊ณผ์ •์„ ๊ฑฐ์นœ๋‹ค๋Š” ๊ฒƒ์€ ์„ค์น˜ ๊ณผ์ •์ด ๋ณต์žกํ•˜๋‹ค๋Š” ๋‹จ์ ์ด ์žˆ๋‹ต๋‹ˆ๋‹ค.

 

๊ทธ๋ ‡๋‹ค๋ฉด Docker๋กœ ํ”„๋กœ๊ทธ๋žจ์„ ์„ค์น˜ํ•˜๊ฒŒ ๋œ๋‹ค๋ฉด ์–ด๋–ป๊ฒŒ ๋ ๊นŒ์š”?

์—ฌ๊ธฐ 'Redis'๋ผ๋Š” ํ”„๋กœ๊ทธ๋žจ์„ Docker์—์„œ ์„ค์น˜ํ•  ๋•Œ, ์˜ˆ์‹œ๋ฅผ ๋ณด์—ฌ ๋“œ๋ฆฌ๋„๋ก ํ• ๊ฒŒ์š”!

 

์œ„์™€ ๊ฐ™์ด ์—„์ฒญ๋‚˜๊ฒŒ ๊ฐ„๋‹จํ•œ ๊ณผ์ •์„ ํ†ตํ•ด ๋‚ด๊ฐ€ ์›ํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์„ค์น˜ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ์ด์—์š”! 

 

 

 

     ๐Ÿ“ Docker์˜ ๊ฐœ๋…

 

Docker์—์„œ๋Š” 'Container' ๋ผ๋Š” ๊ฐœ๋…์„ ์‚ฌ์šฉํ•˜์—ฌ Application์„ ๋” ์‰ฝ๊ฒŒ ๋งŒ๋“ค๊ณ , ๋ฐฐํฌํ•˜๊ณ , ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋„๋ก ์„ค๊ณ„๋œ ๋„๊ตฌ์ด๋ฉฐ, 'Container' ๊ธฐ๋ฐ˜ ์˜คํ”ˆ์†Œ์Šค ๊ฐ€์ƒํ™” ํ”Œ๋žซํผ์ด๋ฉฐ, ์ƒํƒœ๊ณ„ ์ž…๋‹ˆ๋‹ค.

 

์—ฌ๋Ÿฌ๋ถ„๋“ค Container๊ฐ€ ๋ฌด์—‡์ธ๊ฐ€์š”? ์ผ๋ฐ˜์ ์œผ๋กœ ์šฐ๋ฆฌ๊ฐ€ ์•„๋Š” Conatiner๋ผ๋Š” ๊ฒƒ์€ ์•„๋ž˜์™€ ๊ฐ™์ด

๋Œ€๋Ÿ‰์˜ ๋ฌผ๊ฑด์„ ์šด๋ฐ˜ํ•˜๊ธฐ ์œ„ํ•˜์—ฌ ๋ฌผ๊ฑด์„ ๋‹ด๋Š” ํ•˜๋‚˜์˜ ํฐ ๋ฐ”๊ตฌ๋‹ˆ๋ผ๊ณ  ์•Œ๊ณ  ์žˆ์„ ๊ฒƒ์ด์—์š”.

Docker์˜ Container๋„ ์ด์™€ ์œ ์‚ฌํ•œ ๊ฐœ๋…์œผ๋กœ ์ถœ๋ฐœํ•œ๋‹ต๋‹ˆ๋‹ค!

 

Docker์˜ Container๋Š” ํ•˜๋‚˜์˜ Virtual Server ํ˜น์€ Virtual Machine์ด๋ฉฐ, ๊ทธ Server์•ˆ์— ์šฐ๋ฆฌ๊ฐ€ ํ•„์š”ํ•œ Application์„ ์„ค์น˜ํ•˜๊ณ , ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ฃผ๋Š” ๊ฒƒ์ด์—์š”.

์ฆ‰, Container์•ˆ์— ๋‹ค์–‘ํ•œ Application, ์‹คํ–‰ํ™˜๊ฒฝ์„ ์ถ”์ƒํ™”ํ•˜์—ฌ ๋™์ผํ•œ Interface๋ฅผ ์ œ๊ณตํ•˜์—ฌ Application ๋ฐฐํฌ ๋ฐ ๊ด€๋ฆฌ๋ฅผ ๋‹จ์ˆœํ•˜๊ฒŒ ํ•ด ์ฃผ๋Š” ๊ฒƒ์ด์—์š”. ์ผ๋ฐ˜ Container ๊ฐœ๋…์—์„œ ๋ชฐ๊ฑด์„ ์†์‰ฝ๊ฒŒ ์šด์†กํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๋ฐ”๊ตฌ๋‹ˆ์ธ ๊ฒƒ์ฒ˜๋Ÿผ ํ”„๋กœ๊ทธ๋žจ์„ ์†์‰ฝ๊ฒŒ ์ด๋™ ๋ฐ ๋ฐฐํฌ, ๊ด€๋ฆฌ ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ค€๋‹ต๋‹ˆ๋‹ค!

๋˜ํ•œ, Docker๋Š” AWS, Azure, Google Cloud๋‚˜ ๋‚˜์˜ Virtual Machine, ๋‚˜์˜ PC ๋“ฑ ์–ด๋””์—์„œ๋“  ์‹คํ–‰ ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•ด์ฃผ๋Š” ๊ฒƒ์ด์—์š”!

 

 

     ๐Ÿ“ Docker Image์™€ Container์˜ ์ •์˜

 

Continer๋Š” ์ฝ”๋“œ์™€ ๋ชจ๋“  ์ข…์†์„ฑ์„ Packageํ™”ํ•˜์—ฌ Application์ด ํ•œ Computing ํ™˜๊ฒฝ์—์„œ ๋‹ค๋ฅธ Computing ํ™˜๊ฒฝ์œผ๋กœ ๋น ๋ฅด๊ณ , ์•ˆ์ •์ ์œผ๋กœ ์‹คํ–‰๋˜๋„๋ก ํ•˜๋Š” Software์˜ ํ‘œ์ค€ ๋‹จ์œ„ ์ธ ๊ฒƒ์ด์—์š”.

 

ํ˜„์žฌ๊นŒ์ง€ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ๋ฐฉํ–ฅ์œผ๋กœ Container๋ฅผ ์ •์˜ํ•  ๋•Œ, ๊ฐ„๋‹จํ•˜๊ฒŒ ๋˜ํ•œ ํŽธ๋ฆฌํ•˜๊ฒŒ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ์‹คํ–‰ ์‹œ์ผœ์ค€๋‹ค๋Š” ๋Š๋‚Œ์œผ๋กœ ์ •์˜๋ฅผ ๋‚ด๋ฆฌ๋Š” ๊ฒƒ์ด์—์š”.

 

Docker Image๋Š” Code, Runtime, System ๋„๊ตฌ, System library ๋ฐ ์„ค์ •๊ณผ ๊ฐ™์€ Application์„ ์‹คํ–‰ํ•˜๋Š”๋ฐ, ํ•„์š”ํ•œ ๋ชจ๋“  ๊ฒƒ์„ ํฌํ•จํ•˜๋Š” ๊ฐ€๋ณ๊ณ , ๋…๋ฆฝ์ ์ด๋ฉฐ, ์‹คํ–‰ ๊ฐ€๋Šฅํ•œ Software Package ์ธ ๊ฒƒ์ด์—์š”.

 

๋˜ํ•œ, Docker Image๋Š” Runtime์— Container๊ฐ€ ๋˜๊ณ , Docker Container์˜ ๊ฒฝ์šฐ Docker Engin์—์„œ ์‹คํ–‰๋  ๋•Œ, Image๊ฐ€ Container๊ฐ€ ๋˜๋Š” ๊ฒƒ์ด์—์š”.

 

Linux์™€ Windows ๊ธฐ๋ฐ˜ Application ๋ชจ๋‘์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” Containerํ™”๋œ Software๋Š” Infra์— ์ƒ๊ด€์—†์ด ํ•ญ์ƒ ๋™์ผํ•˜๊ฒŒ ์‹คํ–‰๋  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ์ด์—์š”!

Container๋Š” Software๋ฅผ ํ™˜๊ฒฝ์œผ๋กœ๋ถ€ํ„ฐ ๊ฒฉ๋ฆฌ์‹œํ‚ค๊ณ , ๊ฐœ๋ฐœ๊ณผ Staging์˜ ์ฐจ์ด์—๋„ ๋ถˆ๊ตฌํ•˜๊ณ , ๊ท ์ผํ•˜๊ฒŒ ์ž‘๋™ํ•˜๋„๋ก ๋ณด์žฅํ•ด ์ค€๋‹ต๋‹ˆ๋‹ค!

 

 

Docker Image๋Š” Application์„ ์‹คํ–‰ํ•˜๋Š”๋ฐ, ํ•„์š”ํ•œ ์„ค์ •์ด๋‚˜, ์ข…์†์„ฑ์„ ๊ฐ–๊ณ  ์žˆ์œผ๋ฉฐ, Docker Image๋ฅผ ์ด์šฉํ•ด์„œ Container๋ฅผ ์ƒ์„ฑํ•˜๋ฉฐ, Docker Container๋ฅผ ์ด์šฉํ•˜์—ฌ Application์„ ์‹คํ–‰ํ•œ๋‹ค! ๋กœ ์ •๋ฆฌํ•  ์ˆ˜ ์žˆ๊ฒ ์Šต๋‹ˆ๋‹ค!

 

๐Ÿ‘‰ ์œ„ Docker ์ •์˜๋Š” Inflern์˜ '๋”ฐ๋ผํ•˜๋ฉฐ ๋ฐฐ์šฐ๋Š” ๋„์ปค์™€ CIํ™˜๊ฒฝ' ๊ฐ•์˜๋ฅผ ๋“ค์œผ๋ฉฐ, ์ •๋ฆฌํ•œ ๋‚ด์šฉ์ด๋ฉฐ, ๊ด€๋ จ์ž๋ฃŒ๋Š” ๋ชจ๋‘ ํ•ด๋‹น ๊ฐ•์˜์—์„œ ๊ฐ€์ ธ์™”์Œ์„ ์•Œ๋ ค ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

 

 

๐Ÿ“Œ Docker ์„ค์น˜


     ๐Ÿ“ apt ์ตœ์‹ ํ™”

 

 

junyharang@junyharang-virtual-machine:~$ sudo apt-get update

 

 

junyharang@junyharang-virtual-machine:~$ sudo apt-get upgrade

 

๋จผ์ € ์œ„์™€ ๊ฐ™์ด apt๋ฅผ Updateํ•˜์—ฌ Docker ์„ค์น˜๋ฅผ ์ค€๋น„ํ•ด์•ผ ํ•˜๋Š” ๊ฒƒ์ด์—์š”!

 


 

     ๐Ÿ“ ํ•„์ˆ˜ Package ์„ค์น˜

 

 

junyharang@junyharang-virtual-machine:~$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

 


 

     ๐Ÿ“ GPG Key ์ธ์ฆ

 

 

junyharang@junyharang-virtual-machine:~$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

 

์œ„์™€ ๊ฐ™์ด [ OK ]๊ฐ€ ๋œจ๋ฉด ์ •์ƒ์ ์œผ๋กœ ๋œ ๊ฒƒ์ด์—์š”!

 


 

     ๐Ÿ“ Architecture ํ™•์ธ

 

 

junyharang@junyharang-virtual-machine:~$ arch

Architecture์— ๋งž์ถฐ Docker Repository๋ฅผ ๋“ฑ๋ก ํ•ด ์ค„ ๊ฒƒ์ด์—์š”.

์—ฌ๋Ÿฌ๋ถ„์˜ PC(Ubuntu)์˜ Architecture๋ฅผ ํ™•์ธํ•˜๊ณ  ์‹ถ์œผ์‹œ๋‹ค๋ฉด ์œ„์™€ ๊ฐ™์ด ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜์‹œ๋ฉด ํ™•์ธ ๊ฐ€๋Šฅ ํ•˜๋‹ต๋‹ˆ๋‹ค!

 


 

     ๐Ÿ“ Docker Repository ๋“ฑ๋ก

 

 

junyharang@junyharang-virtual-machine:~$ sudo add-apt-repository \
> "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
> $(lsb_release -cs) \
> stable"

 

์œ„์™€ ๊ฐ™์ด ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅ ํ–ˆ์„ ๋•Œ, [ ํŒจํ‚ค์ง€ ๋ชฉ๋ก์„ ์ฝ๋Š” ์ค‘์ž…๋‹ˆ๋‹ค... ์™„๋ฃŒ (์˜์–ด ๋ฒ„์ „์˜ ๊ฒฝ์šฐ Reading Package lists... Done) ] ์ด๋ผ๊ณ  ๋‚˜์˜ฌ ๊ฒฝ์šฐ ์ •์ƒ ์„ค์น˜๊ฐ€ ๋œ ๊ฒƒ ์ด์—์š”!

 

 


 

     ๐Ÿ“ APT๋ฅผ ์ด์šฉํ•˜์—ฌ Docker ์„ค์น˜

 

 

junyharang@junyharang-virtual-machine:~$ sudo apt-get update && sudo apt-get install docker-ce docker-ce-cli containerd.io

 

์œ„์™€ ๊ฐ™์ด apt ๋ช…๋ น์–ด๋ฅผ ์ด์šฉํ•˜์—ฌ Docker๋ฅผ ์„ค์น˜ ํ•ด ์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค!

 

 

junyharang@junyharang-virtual-machine:~$ docker -v

 

์„ค์น˜๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ์™„๋ฃŒ๊ฐ€ ๋˜์—ˆ๋Š”์ง€ ์œ„์˜ ๋ช…๋ น์–ด๋กœ ํ™•์ธ ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ์ด์—์š”!


 

     ๐Ÿ“ Docker ๊ตฌ๋™

 

 

unyharang@junyharang-virtual-machine:~$ sudo systemctl enable docker && service docker start

 

์œ„์˜ ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ Docker๋ฅผ ๊ตฌ๋™ ์‹œ์ผœ ์ฃผ์‹œ๋ฉด ๊ตฌ๋™์ด ๋ฉ๋‹ˆ๋‹ค!

 


 

     ๐Ÿ“ Docker ๊ตฌ๋™ ์—ฌ๋ถ€ ํ™•์ธ

 

 

junyharang@junyharang-virtual-machine:~$ service docker status

 

Active๋ž€์— active(running)์ด๋ผ๊ณ  ๋‚˜์˜ค๋ฉด ์ •์ƒ์ ์œผ๋กœ ๊ตฌ๋™ ๋˜๊ณ  ์žˆ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค!

์ฐธ๊ณ ๋กœ ์ € ์ƒํƒœ์—์„œ 'q'๋ฅผ ๋ˆŒ๋Ÿฌ์•ผ ๋‚˜๊ฐˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค!

 


 

     ๐Ÿ“ Portainer ๊ตฌ์ถ•

 

portainer๋Š” Docker์˜ Image, Container, Network ๋“ฑ์„ ์‰ฝ๊ฒŒ ๊ด€๋ฆฌํ•˜๋„๋ก ๋„์™€์ฃผ๋Š” Graphic User Interface Web Service ์ธ ๊ฒƒ์ด์—์š”.

์—ฌ๊ธฐ์„œ Image๋ž€? ์šฐ๋ฆฌ๊ฐ€ VM Ware์—์„œ Ubuntu๋ฅผ ์„ค์น˜ํ•˜๊ธฐ ์œ„ํ•ด์„œ ๋ฐ›์€ File์˜ ํ™•์žฅ์ž๊ฐ€ .iso์ธ๋ฐ, ์ด๊ฒƒ์€ ๊ฐ€์ƒ CD๋ผ๊ณ  ๋ณด์‹œ๋ฉด ๋˜๊ณ , ์ด๊ฒƒ๊ณผ ์œ ์‚ฌํ•œ Docker์—์„œ ์‚ฌ์šฉ๋˜๋Š” OS ์„ค์น˜์šฉ iso๋ผ๊ณ  ์ดํ•ดํ•˜์‹œ๋ฉด ๋˜๋Š” ๊ฒƒ์ด์—์š”.

Docker์˜ Image๋Š” hub.docker.com์—์„œ ๋”์šฑ ๋งŽ์€ ์ž๋ฃŒ๋ฅผ ์ฐพ์•„ ๋ณผ ์ˆ˜ ์žˆ์œผ๋‹ˆ ํ•„์š”ํ•˜์‹œ๋‹ค๋ฉด ํ•œ๋ฒˆ ํ™•์ธ ํ•ด ๋ณด์‹œ๋Š”๊ฑธ ์ถ”์ฒœ ๋“œ๋ฆฌ๋Š” ๊ฒƒ์ด์—์š”.

Potainer๋ฅผ ๊ตฌ์ถ•ํ•˜๊ธฐ ์ „์— ์œ„์—์„œ ์„ค๋ช…๋“œ๋ฆฐ ์ž์‹ ์˜ PC์— ๋งž๋Š” Architecture๋ฅผ ํ™•์ธํ•˜๊ณ , ๊ทธ๊ฒƒ์— ๋งž๋Š” ๊ฒƒ์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค!

๋จผ์ € Protainer Container๋ฅผ ์„ค์น˜ํ•˜๊ธฐ ์ „์— Container์™€ Host(Ubuntu OS)๊ฐ„์— Volume Matcing์„ ์œ„ํ•œ Directory ์ƒ์„ฑ๋ถ€ํ„ฐ ํ•ด ๋ณด๋„๋ก ํ•  ๊ฒƒ์ด์—์š”.

 

 

๋จผ์ € [ $ df -h ]๋ผ๋Š” ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์šฐ๋ฆฌ Ubuntu๊ฐ€ ํ˜„์žฌ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” Directory๋“ค์„ ํ™•์ธ ํ•ด ๋ณผ ์ˆ˜ ์žˆ๋Š” ๊ฒƒ์ด์—์š”.

๋’ค์— -h Option์€ ์šฉ๋Ÿ‰์— ๋Œ€ํ•ด ์‚ฌ์šฉ๋Ÿ‰ ๋“ฑ์„ Giga Byte ๋‹จ์œ„๋กœ ๋ณด๊ฒ ๋‹ค๋Š” ์˜๋ฏธ์ž…๋‹ˆ๋‹ค.

 

 

sudo ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด root ๊ถŒํ•œ์„ ํ™•๋ณดํ•œ ๋’ค mkdir๋กœ Directory๋ฅผ ๋งŒ๋“œ๋Š” ๊ฒƒ์ด์—์š”.

- mkdir ๋ช…๋ น์–ด Option ์ข…๋ฅ˜

์˜ต์…˜  Long ์˜ต์…˜  ์„ค๋ช…
 -m  --mode=MODE  ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ƒ์„ฑํ• ๋•Œ ๊ถŒํ•œ์„ ์„ค์ •, ๋””ํดํŠธ๋Š” 755
 -p  --parents  ์ƒ์œ„ ๊ฒฝ๋กœ๋„ ํ•จ๊ป˜ ์ƒ์„ฑ
 -v  --verbose  ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ƒ์„ฑ ํ›„, ์ƒ์„ฑ๋œ ๋””๋ ‰ํ† ๋ฆฌ์— ๋Œ€ํ•ด ๋ฉ”์‹œ์ง€ ์ถœ๋ ฅ
   --help  mkdir์˜ ์‚ฌ์šฉ๋ฒ•์„ ์ถœ๋ ฅ
   --version  mkdir์˜ ๋ฒ„์ „ ์ •๋ณด๋ฅผ ์ถœ๋ ฅ

 

์ฃผ๋‹ˆํ•˜๋ž‘์€ ๋ฃจํŠธ Directory [ / ] ๋ฐ‘์— docker๋ผ๋Š” Directory๋ฅผ ๋งŒ๋“ค๊ณ , ๊ทธ ๋ฐ‘์— ๋‹ค์‹œ portainer๋ผ๋Š” Directory๋ฅผ ๋งŒ๋“  ๊ฒƒ์ด์—์š”.

 

junyharang@junyharang-virtual-machine:~$ cd /
junyharang@junyharang-virtual-machine:/$ ls -al
ํ•ฉ๊ณ„ 2097244
drwxr-xr-x  21 root root       4096  7์›” 14 01:40 .
drwxr-xr-x  21 root root       4096  7์›” 14 01:40 ..
lrwxrwxrwx   1 root root          7  7์›” 13 20:45 bin -> usr/bin
drwxr-xr-x   4 root root       4096  7์›” 13 20:56 boot
drwxrwxr-x   2 root root       4096  7์›” 13 20:46 cdrom
drwxr-xr-x  19 root root       4120  7์›” 13 20:57 dev
drwxr-xr-x   3 root root       4096  7์›” 14 01:40 docker
drwxr-xr-x 132 root root      12288  7์›” 13 21:21 etc
drwxr-xr-x   3 root root       4096  7์›” 13 20:47 home
lrwxrwxrwx   1 root root          7  7์›” 13 20:45 lib -> usr/lib
lrwxrwxrwx   1 root root          9  7์›” 13 20:45 lib32 -> usr/lib32
lrwxrwxrwx   1 root root          9  7์›” 13 20:45 lib64 -> usr/lib64
lrwxrwxrwx   1 root root         10  7์›” 13 20:45 libx32 -> usr/libx32
drwx------   2 root root      16384  7์›” 13 20:45 lost+found
drwxr-xr-x   2 root root       4096  2์›” 10 03:47 media
drwxr-xr-x   2 root root       4096  2์›” 10 03:47 mnt
drwxr-xr-x   3 root root       4096  7์›” 13 21:21 opt
dr-xr-xr-x 347 root root          0  7์›” 13 20:57 proc
drwx------   4 root root       4096  7์›” 13 20:51 root
drwxr-xr-x  37 root root       1000  7์›” 13 21:21 run
lrwxrwxrwx   1 root root          8  7์›” 13 20:45 sbin -> usr/sbin
drwxr-xr-x   8 root root       4096  2์›” 10 03:57 snap
drwxr-xr-x   2 root root       4096  2์›” 10 03:47 srv
-rw-------   1 root root 2147483648  7์›” 13 20:45 swapfile
dr-xr-xr-x  13 root root          0  7์›” 13 20:57 sys
drwxrwxrwt  21 root root       4096  7์›” 14 01:37 tmp
drwxr-xr-x  14 root root       4096  2์›” 10 03:48 usr
drwxr-xr-x  14 root root       4096  2์›” 10 03:56 var

 

cd (Change Directory)๋ฅผ ํ†ตํ•ด root Directory [ / ]๋กœ ์ด๋™์„ ํ•œ ๋’ค ls (List) ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด Directory ๋ชฉ๋ก์„ ์ถœ๋ ฅํ•˜๋‹ˆ

์ฃผ๋‹ˆํ•˜๋ž‘์ด ๋งŒ๋“  docker๋ผ๋Š” Directory๊ฐ€ ๋ณด์ด๋Š” ๊ฒƒ์ด์—์š”.

 

์ž! ์ด์ œ potainer๋ฅผ ๊น”์•„ ๋ณด๋Š” ๊ฒƒ์ด์—์š”.

 

junyharang@junyharang-virtual-machine:/$ sudo docker run --name portainer -p 9000:9000 -d --restart always -v /docker/portainer:/data -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer

 

์œ„์˜ ๋ช…๋ น์–ด์˜ ๋‚ด์šฉ์„ ์งง๊ฒŒ ์„ค๋ช…ํ•˜์ž๋ฉด 

 ๐Ÿ‘‰ --name : Container Name ์ƒ์„ฑ

 ๐Ÿ‘‰-p Host Port 9000๋ฒˆ๊ณผ ๋‚ด๋ถ€ Port 9000๋ฒˆ Mapping

 ๐Ÿ‘‰ -d Deamon์„ Background์—์„œ ์‹คํ–‰

 ๐Ÿ‘‰ -restart always : ์žฌ ๋ถ€ํŒ…์‹œ ์ž๋™ ๊ธฐ๋™

 ๐Ÿ‘‰/docker/potainer:/data -v : Host์™€ Container ๊ฐ„์˜ Volume Matcing

 ๐Ÿ‘‰.docker.sock : Host์™€ Container ๊ฐ„์˜ ๊ณต์œ ๋ฅผ ์œ„ํ•œ ๋ช…๋ น์–ด

 ๐Ÿ‘‰portainer/portainer : Image ์‚ฌ์šฉ ์ˆœ์„œ ์ง€์ •

 ๐Ÿ‘‰ ์ปจํ…Œ์ด๋„ˆ ๋ชฉ๋ก: docker ps

 

 ๐Ÿ‘‰ ์ปจํ…Œ์ด๋„ˆ ์‹คํ–‰: docker exec -it [Container ID]


     ๐Ÿ“ Portainer ์‹คํ–‰

 

 

์ฃผ๋‹ˆํ•˜๋ž‘์˜ Windows10 (VM Ware๋ฅผ ๊ธฐ๋™์‹œํ‚จ HostPC)์—์„œ ์›จ์ผ ๋ธŒ๋ผ์šฐ์ €๋ฅผ ํ†ตํ•ด ๊ฐ€์ƒ ๋จธ์‹  OS์ธ Ubuntu์˜ IP (ifconfig ๋ช…๋ น์œผ๋กœ ํ™•์ธ)๋ฅผ ์ž…๋ ฅํ•œ ๋’ค :9000๋ฒˆ์„ ์ž…๋ ฅ ํ•ด ์ฃผ๋ฉด ์ด๋ ‡๊ฒŒ ์ ‘์† ๋˜๋Š” ๊ฒƒ์„ ํ™•์ธ ํ•  ์ˆ˜ ์ž‡๋Š” ๊ฒƒ์ด์—์š”.

 

 

์ตœ์ดˆ ๊ด€๋ฆฌ์ž ๊ณ„์ •์„ ๋งŒ๋“  ๋’ค [ Create user ]๋ฅผ ๋ˆŒ๋Ÿฌ ์ฃผ๋ฉด ๋˜๋Š” ๊ฒƒ์ด์—์š”. 

Username์ด๋‚˜, ๋น„๋ฐ€๋ฒˆํ˜ธ๋Š” ์—ฌ๋Ÿฌ๋ถ„ ๋งˆ์Œ๋Œ€๋กœ ์ •ํ•˜์…”๋„ ์ƒ๊ด€ ์—†์Šต๋‹ˆ๋‹ค!

 

 

[ Local ] ์„ ์„ ํƒํ•˜๊ณ , [ Connetc ]๋ฅผ ๋ˆŒ๋Ÿฌ์ฃผ๋ฉด?

 

 

์งœ์ž”! Portainer ์„ค์น˜ ๋ฐ ๊ตฌ๋™์ด ์™„๋ฃŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค!

 

 


 

์ฃผ๋‹ˆํ•˜๋ž‘์˜ ๊ธ€์ด ๋งˆ์Œ์— ๋“œ์…จ๋‚˜์š”? ๊ตฌ๋…๊ณผ ๊ณต๊ฐ! ๊ทธ๋ฆฌ๊ณ , ๋Œ“๊ธ€์€ ์ฃผ๋‹ˆํ•˜๋ž‘์—๊ฒŒ ๋งŽ์€ ํž˜์ด ๋ฉ๋‹ˆ๋‹ค!

728x90
๋ฐ˜์‘ํ˜•

'System ์ž‘์—…์‹ค > LINUX' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[Linux]Kernel System Call  (0) 2021.08.17
[Linux] ๋ช…๋ น์–ด ์‚ฌ์ „  (0) 2021.08.17
[Ubuntu 20.04] JDK 14์™€ IDE ์„ค์น˜  (0) 2021.02.21
[Ubuntu 20.04] Vmware์— Ubuntu ์„ค์น˜  (0) 2021.02.20
[Ubuntu 20.04] Tomcat8 ์„ค์น˜  (0) 2021.01.22