Ubuntu 20.04 LTSインストールdocker(qbit)


古いバージョンのアンインストール
dockerは発展の中で多くの名前(docker/docker.io/docker-engine)を生み出し、現在(2020/5/26)のパッケージ名はdocker-ce(Docker Engine-Community)である.古いソフトウェアをクリーンアップしようとします.
$ sudo apt remove docker docker-engine docker.io containerd runc

依存パッケージのインストール
#     
sudo apt update
#      
sudo apt install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

倉庫の追加
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

dockerバージョンの確認
$ sudo apt update
$ apt policy docker-ce
docker-ce:
  Installed: (none)
  Candidate: 5:19.03.9~3-0~ubuntu-focal
  Version table:
     5:19.03.9~3-0~ubuntu-focal 500
        500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages

dockerのインストール
sudo apt install docker-ce docker-ce-cli containerd.io

dockerステータスの表示
sudo systemctl status docker

無sudo運転
  • ユーザグループ
  • を追加して切り替える.
    #      
    # $USER          
    sudo usermod -aG docker $USER
    #      
    newgrp docker
  • テスト
  • docker run hello-world

    国内ミラーソースのアクセラレータの設定
  • /etc/docker/daemon.json
  • の作成または変更
    {
        "registry-mirrors" : [
        "https://registry.docker-cn.com",
        "https://docker.mirrors.ustc.edu.cn",
        "http://hub-mirror.c.163.com",
        "https://cr.console.aliyun.com/"
      ]
    }
  • docker
  • を再起動
    sudo systemctl restart docker
  • を表示
    $ docker info | grep -E "Registry|http"
    WARNING: No swap limit support
     Registry: https://index.docker.io/v1/
     Registry Mirrors:
      https://registry.docker-cn.com/
      https://docker.mirrors.ustc.edu.cn/
      http://hub-mirror.c.163.com/
      https://cr.console.aliyun.com/
    

    本文は
    qbit snap