Dockerのインストール
このドキュメントでは、Dockerのインストール手順を実戦形式で説明します.使用するシステムはCentOS 7です.
1 Dockerのインストール
ある場合は古いDockerをアンインストールします.そうしないと互換性がない可能性があります.
Docker-CEコミュニティバージョンのインストール
Dockerの起動
2 dockerミラーアクセラレータを指定します(重要です.そうしないと、後で海外からdockerミラーをダウンロードすると、直接エラーが発生し、速度が遅くなります).
国内docker倉庫加速サイト
アクセラレータノードの設定
表示されない文字に注意!注意:自分のローカルプライベートウェアハウスを使用する必要がある場合は、次のように書きます.
追加のリファレンス構成:
3関連サービスの再起動
4 Dockerシステム情報の表示
5 Dockerミラーのテスト
まとめ
以上がDockerのインストールプロセスです.Dockerの後続操作を見たい方は、私の文章に注目し続けてください.私の文章が皆さんに助けてくれることを願っています.
1 Dockerのインストール
ある場合は古いDockerをアンインストールします.そうしないと互換性がない可能性があります.
[root@Docker ]# yum remove -y docker docker-io docker-selinux python-docer-py
Docker-CEコミュニティバージョンのインストール
[root@Docker ]# yum -y install docker-ce
Dockerの起動
[root@Docker ]# systemctl start docker
[root@Docker ]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@Docker ]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2020-03-30 13:17:47 EDT; 16s ago
Docs: https://docs.docker.com
Main PID: 12932 (dockerd)
CGroup: /system.slice/docker.service
└─12932 /usr/bin/dockerd -H fd:// --containerd=/run/contain...
Mar 30 13:17:47 Docker dockerd[12932 ]: time="2020-0...
Mar 30 13:17:47 Docker dockerd[12932 ]: time="2020-0...
Mar 30 13:17:47 Docker dockerd[12932 ]: time="2020-0...
Mar 30 13:17:47 Docker dockerd[12932 ]: time="2020-0...
Mar 30 13:17:47 Docker dockerd[12932 ]: time="2020-0...
Mar 30 13:17:47 Docker dockerd[12932 ]: time="2020-0...
Mar 30 13:17:47 Docker dockerd[12932 ]: time="2020-0...
Mar 30 13:17:47 Docker dockerd[12932 ]: time="2020-0...
Mar 30 13:17:47 Docker dockerd[12932 ]: time="2020-0...
Mar 30 13:17:47 Docker systemd[1 ]: Started Docker A...
Hint: Some lines were ellipsized, use -l to show in full.
[root@Docker ]# docker version
Client: Docker Engine - Community
Version: 19.03.8
API version: 1.40
Go version: go1.12.17
Git commit: afacb8b
Built: Wed Mar 11 01:27:04 2020
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.8
API version: 1.40 (minimum version 1.12)
Go version: go1.12.17
Git commit: afacb8b
Built: Wed Mar 11 01:25:42 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683
2 dockerミラーアクセラレータを指定します(重要です.そうしないと、後で海外からdockerミラーをダウンロードすると、直接エラーが発生し、速度が遅くなります).
国内docker倉庫加速サイト
https://registry.docker-cn.com
http://hub-mirror.c.163.com
https://3laho3y3.mirror.aliyuncs.com
http://f1361db2.m.daocloud.io
https://mirror.ccs.tencentyun.com
https://docker.mirrors.ustc.edu.cn
http://dockerhub.azk8s.cn/
アクセラレータノードの設定
[root@Docker ]# vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://registry.docker-cn.com" ]
}
表示されない文字に注意!注意:自分のローカルプライベートウェアハウスを使用する必要がある場合は、次のように書きます.
{
"registry-mirrors": ["https://e9yneuymirror.aliyuncs.com" ]
"insecure-registries": ["192.168.10.7:4000" ]
}
追加のリファレンス構成:
{
"insecure-registries": ["0.0.0.0/0" ],
"log-opts": {
"max-size": "20m",
"max-file": "5"
}
}
3関連サービスの再起動
[root@Docker ]# systemctl daemon-reload
[root@Docker ]# systemctl restart docker && systemctl status docker
4 Dockerシステム情報の表示
[root@Docker ]# docker info
Client:
Debug Mode: false
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 19.03.8
Storage Driver: overlay2
Backing Filesystem:
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-957.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.62GiB
Name: Docker
ID: SZWH:KWZM:GDQA:ZRHY:PU7A:JV23:7TX3:SYUM:J3UX:ZEOR:JG44:SDHL
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://registry.docker-cn.com
Live Restore Enabled: false
WARNING: IPv4 forwarding is disabled
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
5 Dockerミラーのテスト
[root@Docker ]# docker image pull centos:latest
latest: Pulling from library/centos
8a29a15cefae: Pull complete
Digest: sha256:fe8d824220415eed5477b63addf40fb06c3b049404242b31982106ac204f6700
Status: Downloaded newer image for centos:latest
docker.io/library/centos:latest
# Docker
[root@Docker ]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos latest 470671670cac 2 months ago 237MB
まとめ
以上がDockerのインストールプロセスです.Dockerの後続操作を見たい方は、私の文章に注目し続けてください.私の文章が皆さんに助けてくれることを願っています.