๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
DevOps/Docker

[Docker] Ubuntu ๋„์ปค ์„ค์น˜

by ๐ŸŒปโ™š 2021. 10. 6.

Ubuntu์™€ Docker

์ด ๊ธ€์—์„œ๋Š” Ubuntu ๋„์ปค ์„ค์น˜์™€ ๊ด€๋ จ๋œ ๋‚ด์šฉ์„ ๋‹ค๋ฃฌ๋‹ค. Docker๋Š” ๋ฆฌ๋ˆ…์Šค๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฆฌ๋ˆ…์Šค ์šด์˜์ฒด์ œ ์œ„์—์„œ ๋Œ์•„๊ฐ€์•ผํ•œ๋‹ค. Ubuntu๋Š” Linux๊ณ„์—ด ์šด์˜์ฒด์ œ๋กœ ๋ฐ”๋กœ ์„ค์น˜๊ฐ€ ๊ฐ€๋Šฅํ•˜๋‹ค.

 

Ubuntu Docker ์„ค์น˜

 

Install Docker Engine on Ubuntu

 

docs.docker.com

$ sudo apt-get update
 
$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

apt๊ฐ€ HTTPS ํ”„๋กœํ† ์ฝœ์„ ํ†ตํ•ด์„œ repository๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•œ๋‹ค.

 

 

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Docker์˜ ๊ณต์‹ GPG key๋ฅผ ์ถ”๊ฐ€ํ•œ๋‹ค.

 

 

$ echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

apt source list์— repository๋ฅผ ์ถ”๊ฐ€ํ•œ๋‹ค.

 

 

$ sudo apt-get update
$ sudo apt-get install docker-ce

apt package index๋ฅผ updateํ•˜๊ณ  Docker๋ฅผ ์„ค์น˜ํ•œ๋‹ค.

 

 

Docker ์ •์ƒ ์„ค์น˜ ํ™•์ธ

ubuntu@ubuntu-Parallels-Virtual-Platform:~$ sudo docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

ubuntu@ubuntu-Parallels-Virtual-Platform:~$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:61bd3cb6014296e214ff4c6407a5a7e7092dfa8eefdbbec539e133e97f63e09f
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

์ •์ƒ์ ์œผ๋กœ Docker๊ฐ€ ์„ค์น˜๋˜๊ณ  ์ด๋ฏธ์ง€๋ฅผ ๋ฐ›์•„์„œ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

๋Œ“๊ธ€