0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Ubuntu24.04にDockerをインストールしよう。

Posted at

本日はタイトルにもある通り、Ubuntu24.04にDockerをインストールしてみます。
今回もインストール手順だけを紹介しますので、コンパクトな記事にしようと思います。

Ubuntu24.04にDockerをインストールする手順

①Dockerのインストール環境を準備

KAGOYA CLOUD VPSからOSでUbuntu24.04を選択。
1.png

スペックは2コア/2GB/200GB(日額28円)を選択。
2.png

この内容でインスタンスを作成します。

②インストール作業

パッケージリストの準備。

sudo apt update
sudo apt install -y ca-certificates curl gnupg

DockerのGPGキーを追加。

sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

公式のDockerリポジトリを追加。

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

再度、パッケージリストを更新。

sudo apt update

ここでようやくDockerをインストール。

sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

これでDockerのインストールが完了となります。
念のため、正常に動くか試してみます。

sudo docker run hello-world

3.png
問題なく稼働していることが確認できました!

最後に

はじめ、油断して何も考えずにUbuntu20.04と同じコマンドを叩いたところ、正しくインストールが走らず焦りました。
が、基本的な流れはUbuntu24.04でも同じでしたので、そこまで苦労することなくインストールができました。

ただ、この状態ではsudo権限が無いとDockerを使えない状態ですので、必要に応じて追加でコマンドを叩きましょう。
(この辺りのコマンドは本家サイトの方でご紹介しております。)

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?