Ubuntu Desktop 24.04にDockerをインストールする!

Ubuntu Desktop 24.04にDockerをインストールします。

OSの情報を確認する!

OSの情報を表示します。

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04.4 LTS"

Kernelの情報を表示します。

$ uname -omr
6.17.0-14-generic x86_64 GNU/Linux

Dockerのインストール情報を確認する!

Dockerのインストール情報を確認します。

Dockerの前提パッケージをインストールする!

Dockerの前提パッケージをインストールします。

$ sudo apt install ca-certificates curl gnupg lsb-release

Dockerのリポジトリの設定を行う!

Dockerのリポジトリを設定します。

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
$ echo "deb [arch=$(dpkg --print-architecture) 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

Dockerをインストールする!

Dockerをインストールして、起動していることを確認します。

$ sudo apt update
$ sudo apt install docker-ce docker-ce-cli containerd.io -y
$ sudo apt install docker-ce docker-ce-cli containerd.io -y

dockerグループの設定を行い動作確認する!

dockerグループの設定を行い動作確認します。

$ sudo usermod -aG docker $USER
$ newgrp docker
$ docker --version
docker --version
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
17eec7bbc9d7: Pull complete 
ea52d2000f90: Download complete 
Digest: sha256:85404b3c53951c3ff5d40de0972b1bb21fafa2e8daa235355baf44f33db9dbdd
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/

おわりに

Ubuntu Desktop 24.04にDockerをインストールしました。

関連記事