2021-03-04に更新

CentOS7 に Docker をインストールするのを追試しようぜ(^~^)

ぺそーん(^~^) 公開下書き

2021-03-04 thu

CentOS7にDockerをインストールする

ramen-tabero-futsu2.png
「 ↑ 試そうぜ」

kifuwarabe-futsu.png
「 SSH接続は便利だな」

ohkina-hiyoko-futsu.png
「 最近 Telnet に逆戻りしてましたからね」

ramen-tabero-futsu2.png
「 めんどくせ。 root ユーザーになろ」

Input:

yum remove docker docker-common docker-selinux docker-engine

Output:

Loaded plugins: fastestmirror
No Match for argument: docker
No Match for argument: docker-common
No Match for argument: docker-selinux
No Match for argument: docker-engine
No Packages marked for removal

Input:

yum install -y yum-utils device-mapper-persistent-data lvm2

Output:

~略~

Complete!

Input:

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

Output:

Loaded plugins: fastestmirror
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo

Input:

yum makecache fast

Output:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cat.net
 * extras: mirrors.cat.net
 * updates: mirrors.cat.net
base                                                                             | 3.6 kB  00:00:00
docker-ce-stable                                                                 | 3.5 kB  00:00:00
extras                                                                           | 2.9 kB  00:00:00
updates                                                                          | 2.9 kB  00:00:00
(1/2): docker-ce-stable/7/x86_64/updateinfo                                      |   55 B  00:00:00
(2/2): docker-ce-stable/7/x86_64/primary_db                                      |  57 kB  00:00:00
Metadata Cache Created

Input:

yum list docker-ce.x86_64 --showduplicates | sort -r

Output:

 * updates: mirrors.cat.net
Loading mirror speeds from cached hostfile
Loaded plugins: fastestmirror
 * extras: mirrors.cat.net
docker-ce.x86_64            3:20.10.5-3.el7                     docker-ce-stable
docker-ce.x86_64            3:20.10.4-3.el7                     docker-ce-stable
docker-ce.x86_64            3:20.10.3-3.el7                     docker-ce-stable
docker-ce.x86_64            3:20.10.2-3.el7                     docker-ce-stable
docker-ce.x86_64            3:20.10.1-3.el7                     docker-ce-stable
docker-ce.x86_64            3:20.10.0-3.el7                     docker-ce-stable
docker-ce.x86_64            3:19.03.9-3.el7                     docker-ce-stable
docker-ce.x86_64            3:19.03.8-3.el7                     docker-ce-stable
docker-ce.x86_64            3:19.03.7-3.el7                     docker-ce-stable
docker-ce.x86_64            3:19.03.6-3.el7                     docker-ce-stable
docker-ce.x86_64            3:19.03.5-3.el7                     docker-ce-stable
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.15-3.el7                    docker-ce-stable
docker-ce.x86_64            3:19.03.14-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.13-3.el7                    docker-ce-stable
docker-ce.x86_64            3:19.03.12-3.el7                    docker-ce-stable
docker-ce.x86_64            3:19.03.11-3.el7                    docker-ce-stable
docker-ce.x86_64            3:19.03.10-3.el7                    docker-ce-stable
docker-ce.x86_64            3:19.03.0-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.9-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.8-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.7-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.6-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.5-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.4-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.3-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.2-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.1-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.0-3.el7                     docker-ce-stable
docker-ce.x86_64            18.06.3.ce-3.el7                    docker-ce-stable
docker-ce.x86_64            18.06.2.ce-3.el7                    docker-ce-stable
docker-ce.x86_64            18.06.1.ce-3.el7                    docker-ce-stable
docker-ce.x86_64            18.06.0.ce-3.el7                    docker-ce-stable
docker-ce.x86_64            18.03.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            18.03.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.12.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.12.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.09.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.09.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.06.2.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.06.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.06.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.03.3.ce-1.el7                    docker-ce-stable
docker-ce.x86_64            17.03.2.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.03.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.03.0.ce-1.el7.centos             docker-ce-stable
 * base: mirrors.cat.net
Available Packages

ramen-tabero-futsu2.png
「 ↑ どのバージョンがいいのか分からないが、とりあえず一番上の数字が大きそうかだぜ」

Index of linux/centos/7/x86_64/stable/Packages/

ohkina-hiyoko-futsu.png
「 ↑ パッケージ名をここから調べないと インストールできなくない?」

Input:

yum install docker-ce-20.10.5-3.el7

# (追記) ↓ こうすれば最新バージョンになるのだった
yum install docker-ce

ramen-tabero-futsu2.png
「 ↑ 他との類推で こんな感じで」

Output:

Total download size: 104 M
Installed size: 428 M
Is this ok [y/d/N]:

Input:

y

Output:

GPG key ~略~
Is this ok [y/N]:

Input:

y

Output:

Complete!

Input:

systemctl start docker

Output なし

Input:

docker run hello-world

Output:

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete
Digest: sha256:7e02330c713f93b1d3e4c5003350d0dbe215ca269dd1d84a4abc577908344b30
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/

Input:

systemctl enable docker

Output:

Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

ramen-tabero-futsu2.png
「 ↑ インストールできたっぽいぜ」

kifuwarabe-futsu.png
「 やったな!」

CentOS7 に最新版の Git をインストールする方法

ohkina-hiyoko-futsu.png
「 ↑ 次は git をインストールしましょう」

Input:

yum -y install gcc curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker autoconf

Output:

Complete!

Index of /pub/software/scm/git/

ramen-tabero-futsu2.png
「 ↑ 最新版が バージョンいくつか 確認」

Input:

cd /usr/local/src/

wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.29.2.tar.gz

Output:

2021-03-04 20:20:57 (2.63 MB/s) - ‘git-2.29.2.tar.gz’ saved [9598404/9598404]

Input:

tar xzvf git-2.29.2.tar.gz

Output:

~略~
git-2.29.2/git-gui/version

Input:

rm -rf git-2.29.2.tar.gz

Output なし

Input:

cd git-2.29.2/

make prefix=/usr/local all

Output:

時間がかかる。

~略~
    GEN bin-wrappers/test-tool

Input:

make prefix=/usr/local install

Output:

~略~
./check_bindir "z$bindir" "z$execdir" "$bindir/git-add"

Input:

git --version

Output:

git version 2.29.2

ramen-tabero-futsu2.png
「 ↑ インストールできたっぽいぜ」

kifuwarabe-futsu.png
「 やったな!」

Install Compose on Linux systems

ohkina-hiyoko-futsu.png
「 ↑ 次は docker-compose を インストールしましょう!」

# バージョンは最新にしてください
curl -L "https://github.com/docker/compose/releases/download/1.28.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

chmod +x /usr/local/bin/docker-compose

docker-compose -v

Output:

docker-compose version 1.28.5, build c4eb3a1f

ramen-tabero-futsu2.png
「 ↑ インストールできたっぽいぜ」

muzudho/nngs-docker

ohkina-hiyoko-futsu.png
「 ↑ 次は 自作のリポジトリを git で取り寄せましょう!」

Input:

cd /usr/local/src

git clone https://github.com/muzudho/nngs-docker.git

cd nngs-docker

export COMPOSE_PROJECT_NAME=nngs

# Git Hub のアカウント名をセットしてください
set NNGS_GIT_USER_NAME=yourname

# Git Hub にログインするためのE-mailをセットしてください
set [email protected]

Input:

vi docker-compose.yml
volumes:
  - C:/Users/むずでょ/Documents/shared/nngs/nngssrv/stats:/app/nngs/nngssrv/stats
# ↑ この1行を
# ↓ こんな感じに書きかえてくれだぜ
  - /usr/var/lib/nngs-stats:/app/nngs/nngssrv/stats

Input:

# 時間のかかる処理
docker-compose up -d --build
apt-utils

ramen-tabero-futsu2.png
「 ↑ エラーが出た。インストールしないといけないパッケージがあるのか。覚えとこ」

The command '/bin/sh -c ./configure --prefix=/app/nngs' returned a non-zero code: 126

ramen-tabero-futsu2.png
「 ↑ エラーが出た。 cpuid2cpuflags をインストールしないでみるか」

RUN chmod +x configure

ramen-tabero-futsu2.png
「 ↑ ファイルに実行権限が付いてないのか?」

ramen-tabero-futsu2.png
「 不具合を避ける感じで 直した」

何度でもクリック!→

むずでょ

光速のアカウント凍結されちゃったんで……。ゲームプログラムを独習中なんだぜ☆電王戦IIに出た棋士もコンピューターもみんな好きだぜ☆▲(パソコン将棋)WCSC29一次予選36位、SDT5予選42位▲(パソコン囲碁)AI竜星戦予選16位

Crieitは個人で開発中です。 興味がある方は是非記事の投稿をお願いします! どんな軽い内容でも嬉しいです。
なぜCrieitを作ろうと思ったか

また、「こんな記事が読みたいけど見つからない!」という方は是非記事投稿リクエストボードへ!

こじんまりと作業ログやメモ、進捗を書き残しておきたい方はボード機能をご利用ください!

ボードとは?

むずでょ の最近の記事