iT邦幫忙

2021 iThome 鐵人賽

DAY 2
0
自我挑戰組

從雲端開始的菜鳥任務系列 第 2

DAY2 安裝 Docker

DAY 2

今天要來安裝kubernetes,不過在安裝k8s前我們需要先裝docker,有關docker的介紹可以參考之前的文章:Day2 淺談Docker-虛擬機器和容器的差別,以下我們直接進入docker的安裝步驟。

Docker 安裝步驟

1.更新apt並安裝軟體包用來通過HTTPS獲取存儲庫

apt-get update
apt-get install -y apt-transport-https \
   ca-certificates \
   curl \
   gnupg-agent \
   software-properties-common

2.加入Docker的官方GPG密鑰

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -

3.設定穩定版本的存儲庫

add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

4.更新apt,安裝最新版本的Docker Engine-Community和Containerd

apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io

5.測試Docker是否安裝成功,輸入以下指令,出現以下訊息則安裝成功

$ 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/

明天再來裝kubernetes,又過一天:)


上一篇
Day 1 參賽前言
下一篇
DAY3 安裝 Kubernetes
系列文
從雲端開始的菜鳥任務30

尚未有邦友留言

立即登入留言