通过Dockerfile镜像文件部署工具
若需在容器环境中通过Dockerfile镜像文件制作DevKit镜像来部署DevKit工具,请参考以下指导进行操作。
安装前请确认宿主机空间充足,安装全量包至少需要预留20GB。
- 请参见获取软件包获取DevKit Web工具软件包(DevKit-All-x.x.x-Linux-Kunpeng.tar.gz软件包)。
- 在本地创建Dockerfile文件。文件内容示例如下:
#创建基础镜像,以openEuler 22.03为例。 from openeuler-22.03-lts-sp2:latest ARG package_name=DevKit-All-x.x.x-Linux-Kunpeng COPY auto_install.exp $package_name.tar.gz /usr/local/ #请自行配置网络和Yum源,确保能通过Yum安装软件包。 RUN yum install -y expect tcl sudo util-linux && \ yum clean all && \ cd /usr/local/ && \ tar xvf $package_name.tar.gz && \ mv auto_install.exp $package_name/ && \ cd $package_name/ && \ expect -f ./auto_install.exp && \ rm -fr /usr/local/* EXPOSE 8086 CMD /opt/DevKit/tools/docker_service.sh start devkit_nginx && /opt/DevKit/tools/docker_service.sh start gunicorn_framework && /opt/DevKit/tools/docker_service.sh start gunicorn_plugin && /opt/DevKit/tools/docker_service.sh start java_perf && tail -f /dev/null
- package_name为解压后DevKit Web全量工具包名称。
- DevKit-All-x.x.x-Linux-Kunpeng中的x.x.x表示版本号。
- 在本地创建auto_install.exp文件。文件内容示例如下:
#!/usr/bin/expect -f set timeout -1 spawn ./install.sh expect { "*Do you want to continue*" {send "y\r"; exp_continue} "*Enter the sequence number of the tool access mode for your installation*" {send "1\r"} } expect "*Enter the sequence number of the tool to be installed*" send "1\r" expect { "*failed in the installation environment check?*" {send "y\r"; exp_continue} "*Enter the installation path*" {send "\r"} } expect { "*sequence number of the listed IP address as the web server IP*" {send "\r"; exp_continue} "*Please enter the installation port*" {send "\r"; exp_continue} "*continue the installation*" {send "y\\n"; exp_continue} "*failed in the installation environment check*" {send "y\r"; exp_continue} "The tool will create 10 users*" {send "y\n"; exp_continue} "*y/n default:*" {send "n\r"; exp_continue} "*installation of these components*" {send "y\r"; exp_continue} "Are you agree to install the ufw command?*" {send "n\r"; exp_continue} "Do you want to set image sources*" {send "n\r"; exp_continue} "*do you want to use it*" {send "y\r"; exp_continue} eof { exit 0 } } - 下载完成后请将DevKit Web全量工具包和Dockerfile、auto_install.exp文件上传到工作节点上同一目录下。
目录结构如下:

- 执行构建操作。
1docker build -t devkit-web -f ./Dockerfile .
devkit-web为镜像名称,可自定义镜像名称。
构建过程如下:

回显示例如下表示构建成功:

- 查看构建成功的镜像。
1docker image list
查看构建成功的镜像相关信息:

- 启动容器。
docker run -d -p 8086:8086 --name devkit devkit-web:latest
- 8086:8086:第一个8086为宿主机端口号,可自定义宿主机端口号,后续可以通过https://宿主机IP地址:宿主机端口号访问DevKit Web工具。第二个8086为默认的DevKit服务端口,无需修改。
- --name devkit:指定容器名称,可自定义容器名称。
父主题: 常用操作