[ad_1]
工具箱可让您 在容器中分类和管理您的开发环境 无需 root 权限或手动附加卷。 它创建了一个容器,您可以在其中安装自己的 CLI 工具,而无需将它们安装在基本系统本身上。 当您没有 root 访问权限或无法直接安装程序时,您也可以使用它。 本文将向您介绍工具箱及其功能。
安装工具箱
Silverblue 默认包含 Toolbox。 对于工作站和服务器版本,您可以使用 dnf install 工具箱从默认存储库中获取它。
创建工具箱
打开终端并运行工具箱输入。 该实用程序将自动请求下载最新映像的权限,创建您的第一个容器,并将您的 shell 放入此容器中。
$ toolbox enter No toolbox containers found. Create now? [y/N] y Image required to create toolbox container. Download registry.fedoraproject.org/f30/fedora-toolbox:30 (500MB)? [y/N]: y
目前,工具箱和您的基本系统之间没有区别。 您的文件系统和包看起来没有改变。 这是一个使用存储库的示例,该存储库在 ~/src/resume 文件夹下包含简历的文档源。 简历是使用 pandoc 工具构建的。
$ pwd /home/rwaltr $ cd src/resume/ $ head -n 5 Makefile all: pdf html rtf text docx pdf: init pandoc -s -o BUILDS/resume.pdf markdown/* $ make pdf bash: make: command not found $ pandoc -v bash: pandoc: command not found
此工具箱没有构建简历所需的程序。 您可以通过使用 dnf 安装工具来解决此问题。 不会提示您输入 root 密码,因为您正在容器中运行。
$ sudo dnf groupinstall "Authoring and Publishing" -y && sudo dnf install pandoc make -y ... $ make all #Successful builds mkdir -p BUILDS pandoc -s -o BUILDS/resume.pdf markdown/* pandoc -s -o BUILDS/resume.html markdown/* pandoc -s -o BUILDS/resume.rtf markdown/* pandoc -s -o BUILDS/resume.txt markdown/* pandoc -s -o BUILDS/resume.docx markdown/* $ ls BUILDS/ resume.docx resume.html resume.pdf resume.rtf resume.txt
随时运行 exit 退出工具箱。
$ cd BUILDS/ $ pandoc --version || ls pandoc 2.2.1 Compiled with pandoc-types 1.17.5.4, texmath 0.11.1.2, skylighting 0.7.5 ... for a particular purpose. resume.docx resume.html resume.pdf resume.rtf resume.txt $ exit logout $ pandoc --version || ls bash: pandoc: command not found... resume.docx resume.html resume.pdf resume.rtf resume.txt
您将工具箱创建的文件保留在您的主目录中。 安装在您的工具箱中的任何程序都不能在它之外使用。
技巧和窍门
这个对工具箱的介绍只是触及了表面。 这里有一些额外的提示,但您也可以查看 官方文档.
- Toolbox –help 将显示 Toolbox 的手册页
- 您可以同时拥有多个工具箱。 使用 toolbox create -c Toolboxname 和 toolbox enter -c Toolboxname
- 工具箱用途 波德曼 做繁重的工作。 使用工具箱列表查找工具箱创建的容器的 ID。 Podman 可以使用这些 ID 来执行 rm 和 stop 等操作。 (您还可以在此杂志文章中阅读有关 Podman 的更多信息。)
[ad_2]