【2022世界杯开源项目实战】使用docker部署world-cup-2022-cli-dashboard数据看板工具
【摘要】 【2022世界杯开源项目实战】使用docker部署world-cup-2022-cli-dashboard数据看板工具
@TOC
一、world-cup-2022-cli-dashboard介绍
1.工具介绍
world-cup-2022-cli-dashboard是一款2022 年世界杯 CLI 仪表板工具。可通过这个看板获取相关世界杯比赛详细信息。
2.数据看板的内容
⚽现场比赛(进球、预订、换人)
🗒️球队阵容
📅预定和过去的比赛
📊榜
二、检查本地docker环境
1.检查docker版本
[root@ecs-ff75 worldcup]# docker version
Client: Docker Engine - Community
Version: 20.10.21
API version: 1.41
Go version: go1.18.7
Git commit: baeda1f
Built: Tue Oct 25 18:04:24 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.21
API version: 1.41 (minimum version 1.12)
Go version: go1.18.7
Git commit: 3056208
Built: Tue Oct 25 18:02:38 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.10
GitCommit: 770bd0108c32f3fb5c73ae1264f7e503fe7b2661
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0
2.检查docker状态
[root@ecs-ff75 worldcup]# 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 Sat 2022-12-03 00:31:49 CST; 21min ago
Docs: https://docs.docker.com
Main PID: 8283 (dockerd)
Tasks: 9
Memory: 464.6M
CGroup: /system.slice/docker.service
└─8283 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Dec 03 00:31:49 ecs-ff75 dockerd[8283]: time="2022-12-03T00:31:49.881153099+08:00" level=info msg="Daemon has completed initialization"
Dec 03 00:31:49 ecs-ff75 systemd[1]: Started Docker Application Container Engine.
Dec 03 00:31:49 ecs-ff75 dockerd[8283]: time="2022-12-03T00:31:49.909840654+08:00" level=info msg="API listen on /var/run/docker.sock"
Dec 03 00:33:40 ecs-ff75 dockerd[8283]: time="2022-12-03T00:33:40.907384993+08:00" level=info msg="Layer sha256:38a9ab4169808f74248d152a73b8dc2441d50d8...leaned up"
Dec 03 00:33:41 ecs-ff75 dockerd[8283]: time="2022-12-03T00:33:41.025072845+08:00" level=info msg="Layer sha256:38a9ab4169808f74248d152a73b8dc2441d50d8...leaned up"
Dec 03 00:33:48 ecs-ff75 dockerd[8283]: time="2022-12-03T00:33:48.545709116+08:00" level=info msg="ignoring event" container=fc9f70b878e60a809971445741...askDelete"
Dec 03 00:33:49 ecs-ff75 dockerd[8283]: time="2022-12-03T00:33:49.200137067+08:00" level=info msg="Layer sha256:c0ab059db9d82cb1a277976e4b0b5c729ab7df6...leaned up"
Dec 03 00:36:27 ecs-ff75 dockerd[8283]: time="2022-12-03T00:36:27.309079392+08:00" level=info msg="ignoring event" container=01e7d89b56f4e8fdd2246d96ef...askDelete"
Dec 03 00:49:08 ecs-ff75 dockerd[8283]: time="2022-12-03T00:49:08.153074321+08:00" level=info msg="ignoring event" container=a634f6293cc5fd92d115eefd09...askDelete"
Dec 03 00:52:49 ecs-ff75 dockerd[8283]: time="2022-12-03T00:52:49.917432199+08:00" level=info msg="ignoring event" container=8e3883a46406c42797680b7b52...askDelete"
Hint: Some lines were ellipsized, use -l to show in full.
三、构建world-cup-2022-cli-dashboard的镜像
1.下载world-cup-2022-cli-dashboard源码
[root@ecs-ff75 worldcup]# git clone https://github.com/cedricblondeau/world-cup-2022-cli-dashboard.git
Cloning into 'world-cup-2022-cli-dashboard'...
remote: Enumerating objects: 286, done.
remote: Counting objects: 100% (70/70), done.
remote: Compressing objects: 100% (50/50), done.
remote: Total 286 (delta 30), reused 38 (delta 17), pack-reused 216
Receiving objects: 100% (286/286), 1.71 MiB | 0 bytes/s, done.
Resolving deltas: 100% (130/130), done.
[root@ecs-ff75 worldcup]# ls
world-cup-2022-cli-dashboard
2.直接构建镜像
[root@ecs-ff75 worldcup]# docker build world-cup-2022-cli-dashboard
Sending build context to Docker daemon 3.192MB
Step 1/5 : FROM golang:1.19-alpine
1.19-alpine: Pulling from library/golang
c158987b0551: Pull complete
019cfb932eb0: Pull complete
4deb04624f23: Pull complete
1400322eb6d1: Pull complete
Digest: sha256:8bd8a4b55b233ea77a81250f83637553ef9e3348c5a0cc3ce440c5d45bf7d51d
Status: Downloaded newer image for golang:1.19-alpine
---> c17d5d410602
Step 2/5 : ENV TERM xterm-256color
---> Running in b6b16092f715
Removing intermediate container b6b16092f715
---> 58cab8848820
Step 3/5 : ENV COLORTERM truecolor
---> Running in 5229d2ed04b2
Removing intermediate container 5229d2ed04b2
---> 101006beeb08
Step 4/5 : RUN go install github.com/cedricblondeau/world-cup-2022-cli-dashboard@latest
---> Running in fc9f70b878e6
go: downloading github.com/cedricblondeau/world-cup-2022-cli-dashboard v1.2.1
go: downloading github.com/charmbracelet/bubbletea v0.23.1
go: downloading github.com/charmbracelet/bubbles v0.14.0
go: downloading github.com/charmbracelet/lipgloss v0.6.0
go: downloading github.com/containerd/console v1.0.3
go: downloading github.com/mattn/go-isatty v0.0.16
go: downloading github.com/mattn/go-localereader v0.0.1
go: downloading github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b
go: downloading github.com/muesli/cancelreader v0.2.2
go: downloading github.com/muesli/reflow v0.3.0
go: downloading github.com/muesli/termenv v0.13.0
go: downloading golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
go: downloading github.com/mattn/go-runewidth v0.0.14
go: downloading golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab
go: downloading github.com/rivo/uniseg v0.2.0
go: downloading github.com/aymanbagabas/go-osc52 v1.0.3
go: downloading github.com/lucasb-eyer/go-colorful v1.2.0
Removing intermediate container fc9f70b878e6
---> 444bf96ddcc5
Step 5/5 : ENTRYPOINT world-cup-2022-cli-dashboard
---> Running in 178e01b73eaa
Removing intermediate container 178e01b73eaa
---> 0b4224ef9737
Successfully built 0b4224ef9737
3.构建镜像时指定镜像名称
[root@ecs-ff75 worldcup]# docker build world-cup-2022-cli-dashboard -t world-cup-2022-cli-dashboard
Sending build context to Docker daemon 3.192MB
Step 1/5 : FROM golang:1.19-alpine
---> c17d5d410602
Step 2/5 : ENV TERM xterm-256color
---> Using cache
---> 58cab8848820
Step 3/5 : ENV COLORTERM truecolor
---> Using cache
---> 101006beeb08
Step 4/5 : RUN go install github.com/cedricblondeau/world-cup-2022-cli-dashboard@latest
---> Using cache
---> 444bf96ddcc5
Step 5/5 : ENTRYPOINT world-cup-2022-cli-dashboard
---> Using cache
---> 0b4224ef9737
Successfully built 0b4224ef9737
Successfully tagged world-cup-2022-cli-dashboard:latest
4.查看world-cup-2022-cli-dashboard镜像
[root@ecs-ff75 worldcup]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
world-cup-2022-cli-dashboard latest 0b4224ef9737 5 minutes ago 391MB
golang 1.19-alpine c17d5d410602 20 hours ago 354MB
四、运行world-cup-2022-cli-dashboard容器
运行world-cup-2022-cli-dashboard容器,快速进行cli-dashboard的界面。
[root@ecs-ff75 worldcup]# docker run -ti -e TZ=Asia/Shanghai world-cup-2022-cli-dashboard
五、创建world-cup-2022-cli-dashboard工具
1.将world-cup-2022-cli-dashboard容器设置别名
[root@ecs-ff75 worldcup]# alias worldcup='docker run -it --rm -e TZ=America/Toronto world-cup-2022-cli-dashboard'
[root@ecs-ff75 worldcup]#
2.查看系统别名
[root@ecs-ff75 worldcup]# alias worldcup='docker run -it --rm -e TZ=America/Toronto world-cup-2022-cli-dashboard'
[root@ecs-ff75 worldcup]# alias
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
alias worldcup='docker run -it --rm -e TZ=America/Toronto world-cup-2022-cli-dashboard'
六、使用world-cup-2022-cli-dashboard工具
1.运行world-cup-2022-cli-dashboard的临时容器
worldcup
2.切换比赛
【版权声明】本文为华为云社区用户原创内容,未经允许不得转载,如需转载请自行联系原作者进行授权。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)