
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
Tag GOV.UK content with topics generated using Latent Dirichlet Allocation (https://github.com/ukgovdatascience/govuk-lda-tagger-lite) in a https://www.docker.com container.
The easiest way to get started with this image is to run the following command from a terminal (ensuring that docker is installed):
#!/bin/bash docker run -i --rm -v ${PWD}/output:/mnt/output \ -v ${PWD}/experiments:/mnt/experiments \ ukgovdatascience/govuk-lda-tagger-image:latest python train_lda.py \ --output-topics /mnt/output/topics.csv \ --output-tags /mnt/output/tags.csv \ --vis-filename /mnt/output/vis.html \ --numtopics 7 \ --passes 1 \ import input/url_text.csv
This will download the pre-built container from https://hub.docker.com/r/ukgovdatascience/govuk-lda-tagger-image/, and run and test based on data included in the https://github.com/ukgovdatascience/govuk-lda-tagger-lite repository.
Output files and experiment data will be produced in new directories called ./output/ and ./experiments respectively, so ensure that you run the command from a working directory.
To run the container on real data, a mount point can be set up to access local files, for example:
docker run -i --rm -v ${PWD}/output:/mnt/output \ -v ${PWD}/experiments:/mnt/experiments \ -v ${PWD}/input:/mnt/input \ ukgovdatascience/govuk-lda-tagger-image:latest python train_lda.py \ --output-topics /mnt/output/topics.csv \ --output-tags /mnt/output/tags.csv \ --vis-filename /mnt/output/vis.html \ --numtopics 7 \ --passes 1 \ import /mnt/input/url_text.csv
New data files can then be added to the local ./input folder, and can be found in the container at /mnt/input.
Tests that the container will produces the expected output can be run from the project root with the command pytest.
Note that the https://github.com/ukgovdatascience/govuk-lda-tagger-lite repository is a submodule of this repository. This means that it is a git repository within a git repository. When pulling this repo for the first time, you must run the commands:
git submodule init git submodule update
This will pull the govuk-lda-tagger-lite repository to version specified in the last commit. Note that you can interact with the submodule like any other git repository, and so it is possible to change branch, checkout a commit, etc. which will change the version of the repo available to the parent repo. Running git status will advise on the status of the submodule.
More information about submodules is available here: https://git-scm.com/book/en/v2/Git-Tools-Submodules.
Once you have cloned the repository, and initiated the submodules, you can build the image from the local directory with:
docker build -t ukgovdatascience/govuk-lda-tagger-image:latest .
Note that the :latest part can be substituted for another tag (e.g. a version number) for development purposes.
git clone https://www.github.com/ukgovdatascience/govuk-lda-tagger-image && cd govuk-lda-tagger-image to get a copy of the input data and to navigate to that folder../run.sh to run a test script.git submodule init && git submodule update.docker build -t ukgovdatascience/govuk-lda-tagger-image:latest .To transfer data to and from your local machine you can use scp. SCP uses the same authentication mechanism as SSH, so if you have followed the above steps, it should be very easy!
Uploading data to the databox
From the local machine (replacing 0.0.0.0 with the actual IP returned by terafform apply...):
# Create a folder in which to store input data ssh ubuntu@0.0.0.0 'mkdir -p /home/ubuntu/govuk-lda-tagger-image/input' # Secure copy input_data.csv from local to the newly created input folder scp input_data.csv ubuntu@0.0.0.0:/home/ubuntu/govuk-lda-tagger-image/input/input_data.csv
Downloading data to your local machine
From the local machine (again replacing 0.0.0.0 with the actual IP of the remote machine):
# Specifying `-r` allows a recursive copy of the whole folder scp -r ubuntu@0.0.0.0:/home/ubuntu/govuk-lda-tagger-image/output ./
If you want to verify that the docker contaien ris working as expected, you can run the tests which are written in python with pytest. Note that this contains a docker run command, so will pull the image from docker hub if it is not available locally.
# Install pytest with pip sudo apt install python-pip pip install pytest # Run tests cd /home/ubuntu/govuk-lda-tagger-image/ sudo python -m pytest
Note the need to call pytest with sudo, to enable the removal of test files.
You may need to gain access to the docker container itself for dbugging purposes. This can be achieved with:
docker run -i -t ukgovdatascience/govuk-uk-lda-tagger-image /bin/bash
This will open a bash shell to the container.
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务