ここにカタログタイトルを書く
1.Dockerをインストールします
- 古いバージョンをアンインストールします
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2.必要なインストールパッケージ
yum install -y yum-utils
3.ミラーリングされた倉庫をセットアップします
# 默认是国外的
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
# 推荐使用阿里云的
sudo yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4.yumパッケージインデックスを更新します
yum makecache fast
5.Docker関連のエンジンをインストールします
yum install docker-ce docker-ce-cli containerd.io
6.dockerを起動します
[root@localhost /]# systemctl start docker
7. dockerバージョンを使用して、インストールが成功したかどうかをテストします
[root@localhost /]# docker version
Client: Docker Engine - Community
Version: 20.10.2
API version: 1.41
Go version: go1.13.15
Git commit: 2291f61
Built: Mon Dec 28 16:17:48 2020
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.2
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: 8891c58
Built: Mon Dec 28 16:16:13 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.3
GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc:
Version: 1.0.0-rc92
GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
docker-init:
Version: 0.19.0
GitCommit: de40ad0
8.テストのためにhello-worldを実行します(省略可能)
[root@localhost /]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete
Digest: sha256:1a523af650137b8accdaed439c17d684df61ee4d74feac151b5b337bd29e7eec
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/
9.Dockerが国内のミラーに取って代わります
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://lj1g9tkb.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
2.DockerComposeをインストールします
1.次のコマンドを実行して、DockerComposeの現在の安定バージョンをダウンロードします。
# 官网命令
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# 推荐命令
curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
2.実行可能権限をバイナリファイルに適用します。
chmod +x /usr/local/bin/docker-compose
注:インストール後にコマンドdocker-composeが失敗した場合は、パスを確認してください。/ usr / binまたはパス内の他のディレクトリへのシンボリックリンクを作成することもできます。
例えば;
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
3.インストールをテストします。
docker-compose --version
3.DeviceHiveの展開
- devicehive-dockerをgithubからローカルにクローンします
git clone https://github.com/devicehive/devicehive-docker
- フォルダに切り替えます
cd devicehive-docker/rdbms-image/
- インストールを正常に実行し、対応するコンテナを生成します
sudo docker-compose up -d
4.ブラウザテスト
# 在浏览器输入http://你的IP地址/admin/
Login:dhadmin
password:dhadmin_#911