#author("2022-08-01T06:06:03+09:00","","") *Docker めも on Ubuntu Server 22.04 LTS [#q12884c9] -現時点で暫定で Ubuntu Server にと考えてるけど詳細未定 --現時点でわかってること: apt install Docker はするなということ (2015年の古いバージョンが入るため?) ---↑ Desktopでの話かも。Server だとほぼ最新がはいるよーにみえましたが、まあとりあえず最新をいれる方法をメモります。 **事前準備 [#b7ce0508] ***前提パッケージの導入 [#de480556] $ sudo apt update $ sudo apt install apt-transport-https ca-certificates curl gnupg lsb-release -y ***Docker 公式の GnuPG鍵追加+リポジトリ追加 [#d0816929] $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg (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 (リポジトリ追加) $ cat /etc/apt/sources.list.d/docker.list deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu jammy stable (Ubuntu 22.04 のjammy というのと、安定版 stable の記述確認) $ sudo apt update (リポジトリを更新する) **Docker のインストール [#hf321f2c] $ sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y 事前準備がすめばこれだけです。 バージョン確認はsudoつけて。 $ sudo docker version Client: Docker Engine - Community Version: 20.10.17 API version: 1.41 Go version: go1.17.11 Git commit: 100c701 Built: Mon Jun 6 23:02:46 2022 OS/Arch: linux/amd64 Context: default Experimental: true Server: Docker Engine - Community Engine: Version: 20.10.17 API version: 1.41 (minimum version 1.12) Go version: go1.17.11 Git commit: a89b842 Built: Mon Jun 6 23:00:51 2022 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.6 GitCommit: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1 runc: Version: 1.1.2 GitCommit: v1.1.2-0-ga916309 docker-init: Version: 0.19.0 GitCommit: de40ad0 $ (2022/08/01現在の最新がはいったことが確認とれます) **動作確認 [#aba191e8] $ sudo docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 2db29710123e: Pull complete Digest: sha256:53f1bbee2f52c39e41682ee1d388285290c5c8a76cc92b42687eecf38e0af3f0 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を使わせる [#r8eb2dfc] $ getent group | grep docker これでユーザーがまだいないことを確認。 $ sudo usermod -aG docker arqtan (arqtan ユーザーをdockerグループに追加) $ logout (リログ) $ docker run hello-world (sudo 抜きで実行、同じはろーわーるどが出たら成功)