1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

「docker18.09」の失敗しないインストール方法のまとめ

1
Last updated at Posted at 2019-11-10

docker単体をセットアップしたい人、kubernetesでdockerを利用する際にハマらないセットアップ手順及び参考サイト紹介します。ご自身の環境に適宜読み替えて参考にしてください。

検証環境

OS : Centos7.6(minimal)

インストール時に参考にする情報

基本的には公式サイトを参考するのが良いと思います。
(リンクはcentosの手順ページになります左側のメニューからご自身のデストリビーションを選択してください)

docker インストール手順

上記の公式インストールサイトを参考に私が実行したコマンドを以下に掲載します

1.古いバージョンをアンインストールする

これにより古いバージョンがあればアンインストールします。これらのパッケージがいずれもインストールされていないことが報告されれば問題ありません。(私の環境ではアンインストールされるものはありませんでした)

$ sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

2.dockerに必要なユーティリティを先にインストール

$ sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2

3.yumのリポジトリの追加

$ sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

4.インストールしたいバージョンの確認をする

以下のコマンドを実行すると、インストール可能なバージョンが表示されるので確認します
完全修飾パッケージ名で特定のバージョンをインストールします。完全修飾パッケージ名は、パッケージ名(docker-ce)と、最初のコロン(:)から始まり、ハイフン(-)で区切られた最初のハイフンまでのバージョン文字列(2列目)です。たとえば、docker-ce-19.03.4を指定します

$ sudo yum list docker-ce --showduplicates | sort -r

docker-ce.x86_64            3:19.03.4-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:19.03.3-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:19.03.2-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:19.03.1-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:19.03.0-3.el7                    docker-ce-stable 

5.dockerをインストール

$ sudo yum install docker-ce-18.09.9 docker-ce-cli-18.09.9 containerd.io

6.docker serviceの起動

エラーが表示されなければdocker serviceが起動されています

$ sudo systemctl start docker

7.dockerのバージョンを確認

$ sudo docker version
Client:
 Version:           18.09.9
 API version:       1.39
 Go version:        go1.11.13
 Git commit:        039a7df9ba
 Built:             Wed Sep  4 16:51:21 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.9
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.11.13
  Git commit:       039a7df
  Built:            Wed Sep  4 16:22:32 2019
  OS/Arch:          linux/amd64
  Experimental:     false

参考サイト

1
2
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?