1. 安装docker工具
以Centos7为例
yum install docker -y
2. 下载ubuntu docker镜像
docker pull ubuntu:20.04
查看镜像
docker images | grep ubuntu
ubuntu 20.04 680e5dfb52c7 7 months ago 72.8MB
3. 启动ubuntu容器(命名为tf-center)
docker run -it --name tf-center --restart=always --privileged=true --net=host -d ubuntu:20.04
查看容器是否启动成果
[root@localhost ~]# docker ps | grep tf
56d9282b1b10 ubuntu:20.04 "bash" 51 seconds ago Up 46 seconds tf-center
4. 拷贝tfcenter软件到容器/opt目录中
docker cp tfcenter-linux-v2.1.2.tar.gz tf-center:/opt
5. 进入 tf-center容器
[root@localhost ~]# docker exec -it tf-center bash
查看安装包
root@localhost:/# cd /opt/
root@localhost:/opt# ls
tfcenter-linux-v2.1.2.tar.gz
6. 安装并运行tfcenter软件
root@localhost:/opt# tar xvf tfcenter-linux-v2.1.2.tar.gz
root@localhost:/opt# cd tfcenter-linux
root@localhost:/opt/tfcenter-linux#
root@localhost:/opt/tfcenter-linux# nohup ./tfcenter &
[1] 31
查看运行的端口号(默认是8866)
root@localhost:/opt/tfcenter-linux# cat log/console.txt
2023/05/27 06:05:58 [web:web.StartWebServer(62)] [I] start web :8866
2023/05/27 06:05:58 [shareLinkJson:file.LoadShareLinkJson(19)] [I] load shareLink
2023/05/27 06:05:58 [collectJson:file.LoadCollectJson(19)] [I] load collect
2023/05/27 06:05:58 [logJson:userLog.LoadLogDataJson(21)] [I] load logData
至此tfcenter部署成功,可通过host主机ip 以及 8866 端口进行访问
附录:如何配置docker启动时tfcenter进程自动启动
(1)停止tf-center
[root@localhost ~]# docker stop tf-center
tf-center
(2)将docker容器保存到image镜像tf-center:latest
[root@localhost ~]# docker commit tf-center tf-center:latest
sha256:c39d9cfa947d67eab0e941f028dffe20c7df9d6dcae30bc19dc7c70e6eaf53d3
(3)从tf-center:latest运行docker容器tf-center-1, 并且执行/opt/tfcenter-linux/tfcenter
[root@localhost ~]# docker run -it --name tf-center-1 --restart=always --privileged=true --net=host -d tf-center:latest /opt/tfcenter-linux/tfcenter
e975c8edefeac7fcfa9d10723a75cf36702ace6d67d675a8cb5605a730c659de
(4)执行成功,tfcenter自动运行(重启服务后也自动运行)
[root@localhost ~]# ps -aux | grep tfcenter
root 7808 5.4 0.1 718788 14892 pts/0 Ssl+ 21:16 0:00 /opt/tfcenter-linux/tfcenter