Fedora Workstationにdockerをインストール

Fedora Workstationにdockerをインストール

Fedora Workstationにdockerをインストールする手順を記載してます。動作確認テストでnginxコンテナを起動してます。

fedoraバージョン

fedora30

Docker のリポジトリ登録

## rootで作業
sudo su -

## リポジトリ管理コマンドの確認
dnf install dnf-plugins-core

Fedora Modular 30 - x86_64                      4.0 kB/s | 8.2 kB     00:02
Fedora Modular 30 - x86_64 - Updates            5.9 kB/s | 6.0 kB     00:01
Fedora 30 - x86_64 - Updates                    7.6 kB/s | 6.5 kB     00:00
Fedora 30 - x86_64                              7.3 kB/s | 8.3 kB     00:01
Jenkins                                         6.0 kB/s | 2.9 kB     00:00
nginx repo                                      3.6 kB/s | 2.9 kB     00:00
パッケージ dnf-plugins-core-4.0.7-1.fc30.noarch は既にインストールされています。
依存関係が解決しました。
行うべきことはありません。
完了しました!

インストール済み

## リポジトリ追加
dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
                          nux/fedora/docker-ce.repo
repo の追加: https://download.docker.com/linux/fedora/docker-ce.repo

## 確認
dnf info docker-ce

利用可能なパッケージ
Name         : docker-ce
エポック     : 3
Version      : 19.03.2
リリース     : 3.fc30
Architecture : x86_64
Size         : 24 M
ソース       : docker-ce-19.03.2-3.fc30.src.rpm
Repository   : docker-ce-stable
Summary      : The open-source application container engine
URL          : https://www.docker.com
ライセンス   : ASL 2.0
Description  : Docker is a product for you to build, ship and run any application as a
             : lightweight container.
             :
             : Docker containers are both hardware-agnostic and platform-agnostic. This means
             : they can run anywhere, from your laptop to the largest cloud compute instance and
             : everything in between - and they don't require you to use a particular
             : language, framework or packaging system. That makes them great building blocks
             : for deploying and scaling web apps, databases, and backend services without
             : depending on a particular stack or provider.

インストール

## インストール
dnf install docker-ce

## 確認
docker version

Client: Docker Engine - Community
 Version:           19.03.2
 API version:       1.40
 Go version:        go1.12.8
 Git commit:        6a30dfc
 Built:             Thu Aug 29 05:29:33 2019
 OS/Arch:           linux/amd64
 Experimental:      false

## 自動起動
systemctl enable docker

## 起動
systemctl start docker

## ステータス確認
docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2019-09-10 11:26:52 JST; 1s ago
     Docs: https://docs.docker.com
 Main PID: 6653 (dockerd)
    Tasks: 9
   Memory: 47.4M

Dockerテスト

8889番ポートを利用してnginxコンテナを起動してみる

## firewallの設定
firewall-cmd --zone=public --add-port=8889/tcp --permanent

## nginxコンテナを起動してみる
docker run --name test -d -p 8889:80 nginx

## localから確認
curl -I http://localhost:8889/

Server: nginx/1.17.3
Date: Tue, 10 Sep 2019 02:27:40 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Tue, 13 Aug 2019 08:50:00 GMT
Connection: keep-alive
ETag: "5d5279b8-264"
Accept-Ranges: bytes

別サーバーから確認。ブラウザから http://IPアドレス:8889でアクセス

成功しているので、問題なし