LoginSignup
0
0

More than 1 year has passed since last update.

Dockerインストール

Last updated at Posted at 2023-02-18

目的
環境
手順
エラー処置

目的

UbuntuPCにDocker環境を構築するため、手順を作成しました。

環境

Ubuntu 18.04

手順

Dockerのリポジトリの設定

1.aptパッケージを更新します

sudo apt update

2.必要なパッケージをインストールします

sudo apt install \
     apt-transport-https \
     ca-certificates \
     curl \
     gnupg-agent \
     software-properties-common

3.Docker公式のGPG公開鍵をインストールします

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

4.ingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88であることを確認します

sudo apt-key fingerprint 0EBFCD88

5.repository (stable) を追加します

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

Dockerインストール

1.aptパッケージを更新します

sudo apt update

2.最新版をインストールします

sudo apt-get install docker-ce docker-ce-cli containerd.io

Dockerの動作確認

Dockerが正常に動作しているかを確認します

docker info
docker images

dockerイメージ取得して実行

sudo docker run --rm hello-world

dockerイメージ削除

sudo docker rmi hello-world

エラー処理

もし以下のエラーが出る場合、パーミッションを与えることです。

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json": dial unix /var/run/docker.sock: connect: permission denied

以下のコマンドを実行します。

sudo chmod 666 /var/run/docker.sock

以上、Dockerの環境構築の完成です。

0
0
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
0