mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
commit
f7c80eea51
@ -1,142 +0,0 @@
|
||||
[#]: subject: "Manage containers on Fedora Linux with Podman Desktop"
|
||||
[#]: via: "https://fedoramagazine.org/manage-containers-on-fedora-linux-with-podman-desktop/"
|
||||
[#]: author: "Mehdi Haghgoo https://fedoramagazine.org/author/powergame/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Manage containers on Fedora Linux with Podman Desktop
|
||||
======
|
||||
![][1]
|
||||
|
||||
Podman Desktop is an open-source GUI application for managing containers on Linux, macOS, and Windows.
|
||||
|
||||
Historically, developers have been using Docker Desktop for graphical management of containers. This worked for those who had Docker Daemon and Docker CLI installed. However, for those who used Podman daemon-less tool, although there were a few Podman frontends like [Pods][2], [Podman desktop companion][3], and [Cockpit][4], there was no official application. This is not the case anymore. Enter Podman Desktop!
|
||||
|
||||
This article will discuss features, installation, and use of Podman Desktop, which is developed by developers from Red Hat and other open-source contributors.
|
||||
|
||||
### Installation
|
||||
|
||||
To install Podman Desktop on Fedora Linux, head over to [podman-desktop.io][5], and click the *Download for Linux* button. You will be presented with two options: Flatpak and zip. In this example we are using Flatpak. After clicking *Flatpak*, open it in GNOME Software by double clicking the file (if you are using GNOME). You can also install it via the terminal:
|
||||
|
||||
```
|
||||
flatpak install podman-desktop-X.X.X.flatpak
|
||||
```
|
||||
|
||||
In the above command, replace X.X.X with the specific version you have downloaded. If you downloaded the zip file, then extract the archive, and launch the *Podman Desktop* application binary. You can also find pre-release versions by going to the project’s [releases][6] page on GitHub.
|
||||
|
||||
### Features
|
||||
|
||||
Podman Desktop is still in its early days. Yet, it supports many common container operations like creating container images, running containers, etc. In addition, you can find a Podman extension under Extensions Catalog in Preferences, which you can use to manage Podman virtual machines on macOS and Windows. Futhermore, Podman Desktop has support for Docker Desktop extensions.
|
||||
|
||||
You can install such extensions in the Docker Desktop Extensions section under Preferences. The application window has two panes. The left narrow pane shows different features of the application and the right pane is the content area, which will display relevant information given what is selected on the left.
|
||||
|
||||
![Podman Desktop 0.0.6 running on Fedora 36][7]
|
||||
|
||||
### Demo
|
||||
|
||||
To get an overall view of Podman Desktop’s capabilities, we will create an image from a Dockerfile and push it to a registry, then pull and run it, all from within Podman Desktop.
|
||||
|
||||
#### Build image
|
||||
|
||||
The first step is to create a simple Dockerfile by entering the following lines in the command line:
|
||||
|
||||
```
|
||||
cat <<EOF>>Dockerfile
|
||||
FROM docker.io/library/httpd:2.4
|
||||
COPY . /var/www/html
|
||||
WORKDIR /var/www/html
|
||||
|
||||
CMD ["httpd", "-D", "FOREGROUND"]
|
||||
EOF
|
||||
```
|
||||
|
||||
Now, go to the Images section and press the Build Image button. You will be taken to a new page to specify the Dockerfile, build context and image name. Under Containerfile path, click and browse to pick your Dockerfile. Under image name, enter a name for your image. You can specify a fully qualified image name (FQIN) in the form example.com/username/repo:tag if you want to push the image to a container registry. In this example, I enter quay.io/codezombie/demo-httpd:latest, because I have a public repository named demo-httpd on quay.io. You can follow a similar format to specify your FQIN pointing to your container registry (Quay, Docker Hub, GitHub Container Registry, etc.). Now, press *Build* and wait for the build to complete.
|
||||
|
||||
#### Push image
|
||||
|
||||
Once the build is finished, it’s time to push the image. So, we need to configure a registry in Podman Desktop. Go to Preferences, Registries and press *Add registry.*
|
||||
|
||||
![Add Registry dialog][8]
|
||||
|
||||
In the Add Registry dialog, enter your registry server address, and your user credentials and click ADD REGISTRY.
|
||||
|
||||
Now, I go back to my image in the list of images and push it to the repository by pressing the upload icon. When you hover over the image name that starts with the name of the registry added in the settings (quay.io in this demo), a push button appears alongside the image name.
|
||||
|
||||
![The push button that appears when you hover over the image name][9]
|
||||
|
||||
![Image pushed to repository via Podman Desktop][10]
|
||||
|
||||
Once the image is pushed, anyone with access to the image repository can pull it. Since my image repository is public, you can easily pull it in Podman Desktop.
|
||||
|
||||
#### Pull image
|
||||
|
||||
So, to make sure things work, remove this image locally and pull it in Podman Desktop. Find the image in the list and remove it by pressing the *delete* icon. Once the image is removed, click the *Pull Image* button. Enter the fully qualified name in the *Image to Pull* section and press *Pull image*.
|
||||
|
||||
![Our container image is successfully pulled][11]
|
||||
|
||||
#### Create a container
|
||||
|
||||
As the last part in our Podman Desktop demo, let us spin up a container from our image and check the result. I go to *Containers* and press *Create Container*. This will open up a dialog with two choices: *From Containerfile/Dockerfile*, and *From existing image*. Press *From existing image*. This takes us to the list of images. There, select the image we pulled.
|
||||
|
||||
![Create a container in Podman Desktop][12]
|
||||
|
||||
Now, we select our recently-pulled image from the list and press the *Play* button in front of it. In the dialog that appears, I enter demo-web as *Container Name* and 8000 as *Port Mapping*, and press *Start Container*.
|
||||
|
||||
![Container configuration][13]
|
||||
|
||||
The container starts running and we can check out our Apache server’s default page by running the following command:
|
||||
|
||||
```
|
||||
curl http://localhost:8000
|
||||
```
|
||||
|
||||
![It works!][14]
|
||||
|
||||
You should also be able to see the running container in the Containers list, with its status changed to *Running*. There, you will find available operations in front of the container. For example, you can click the terminal icon to open a TTY into the container!
|
||||
|
||||
![][15]
|
||||
|
||||
### What Comes Next
|
||||
|
||||
Podman Desktop is still young and under [active development][16]. There is a project [roadmap][17] on GitHub with a list of exciting and on-demand features including:
|
||||
|
||||
* Kubernetes Integration
|
||||
* Support for Pods
|
||||
* Task Manager
|
||||
* Volumes Support
|
||||
* Support fo Docker Compose
|
||||
* Kind Support
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/manage-containers-on-fedora-linux-with-podman-desktop/
|
||||
|
||||
作者:[Mehdi Haghgoo][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/powergame/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2022/09/podman-desktop-on-fedora-816x345.jpg
|
||||
[2]: https://github.com/marhkb/pods
|
||||
[3]: https://github.com/iongion/podman-desktop-companion
|
||||
[4]: https://github.com/cockpit-project/cockpit/
|
||||
[5]: https://podman-desktop.io/
|
||||
[6]: https://github.com/containers/podman-desktop/releases/
|
||||
[7]: https://fedoramagazine.org/wp-content/uploads/2022/08/pd.png
|
||||
[8]: https://fedoramagazine.org/wp-content/uploads/2022/08/registry.png
|
||||
[9]: https://fedoramagazine.org/wp-content/uploads/2022/08/image.png
|
||||
[10]: https://fedoramagazine.org/wp-content/uploads/2022/08/Screenshot-from-2022-08-27-23-51-38.png
|
||||
[11]: https://fedoramagazine.org/wp-content/uploads/2022/08/image-2.png
|
||||
[12]: https://fedoramagazine.org/wp-content/uploads/2022/08/image-3.png
|
||||
[13]: https://fedoramagazine.org/wp-content/uploads/2022/08/image-5.png
|
||||
[14]: https://fedoramagazine.org/wp-content/uploads/2022/08/image-6.png
|
||||
[15]: https://fedoramagazine.org/wp-content/uploads/2022/09/image-2-1024x393.png
|
||||
[16]: https://github.com/containers/podman-desktop
|
||||
[17]: https://github.com/orgs/containers/projects/2
|
@ -0,0 +1,142 @@
|
||||
[#]: subject: "Manage containers on Fedora Linux with Podman Desktop"
|
||||
[#]: via: "https://fedoramagazine.org/manage-containers-on-fedora-linux-with-podman-desktop/"
|
||||
[#]: author: "Mehdi Haghgoo https://fedoramagazine.org/author/powergame/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
使用 Podman Desktop 在 Fedora Linux 上管理容器
|
||||
======
|
||||
![][1]
|
||||
|
||||
Podman Desktop 是一个开源 GUI 应用,用于在 Linux、macOS 和 Windows 上管理容器。
|
||||
|
||||
从历史上看,开发人员一直使用 Docker Desktop 对容器进行图形化管理。这适用于那些安装了 Docker Daemon 和 Docker CLI 的人。然而,对于那些使用 Podman daemon-less 工具的人来说,虽然有一些 Podman 前端,如 [Pods][2]、[Podman desktop companion][3] 和 [Cockpit][4],但没有官方应用。现在不是这种情况了。有了 Podman Desktop!
|
||||
|
||||
本文将讨论由 Red Hat 和其他开源贡献者开发的 Podman Desktop 的特性、安装和使用。
|
||||
|
||||
### 安装
|
||||
|
||||
要在 Fedora Linux 上安装 Podman Desktop,请访问 [podman-desktop.io][5],然后单击 *Download for Linux* 按钮。你将看到两个选项:Flatpak 和 zip。在这个例子中,我们使用的是 Flatpak。单击 *Flatpak* 后,通过双击文件在 GNOME 软件中打开它(如果你使用的是 GNOME)。你也可以通过终端安装它:
|
||||
|
||||
```
|
||||
flatpak install podman-desktop-X.X.X.flatpak
|
||||
```
|
||||
|
||||
在上面的命令中,将 X.X.X 替换为你下载的特定版本。如果你下载了 zip 文件,则、那么解压缩存档,然后启动 *Podman Desktop* 应用的二进制文件。你还可以通过进入 GitHub 上项目的[发布][6]页找到预发布版本。
|
||||
|
||||
### 特性
|
||||
|
||||
Podman Desktop 仍处于早期阶段。然而,它支持许多常见的容器操作,如创建容器镜像、运行容器等。此外,你可以在“首选项”的“扩展目录”下找到 Podman 扩展,你可以使用它来管理 macOS 和 Windows 上的 Podman 虚拟机。此外,Podman Desktop 支持 Docker Desktop 扩展。
|
||||
|
||||
你可以在“首选项”下的 “Docker Desktop Extensions” 安装此类扩展。应用窗口有两个窗格。左侧窄窗格显示应用的不同功能,右侧窗格是内容区域,它将根据左侧选择的内容显示相关信息。
|
||||
|
||||
![Podman Desktop 0.0.6 在 Fedora 36 上运行][7]
|
||||
|
||||
### 演示
|
||||
|
||||
为了全面了解 Podman Desktop 的功能,我们将从 Dockerfile 创建一个镜像并将其推送到注册表,然后拉取并运行它,这一切都在 Podman Desktop 中完成。
|
||||
|
||||
#### 构建镜像
|
||||
|
||||
第一步是通过在命令行中输入以下行来创建一个简单的 Dockerfile:
|
||||
|
||||
```
|
||||
cat <<EOF>>Dockerfile
|
||||
FROM docker.io/library/httpd:2.4
|
||||
COPY . /var/www/html
|
||||
WORKDIR /var/www/html
|
||||
|
||||
CMD ["httpd", "-D", "FOREGROUND"]
|
||||
EOF
|
||||
```
|
||||
|
||||
现在,点击“镜像”并按下“构建镜像”按钮。你将被带到一个新页面以指定 Dockerfile、构建上下文和镜像名称。在 Containerfile 路径下,单击并浏览以选择你的 Dockerfile。在镜像名称下,输入镜像的名称。如果要将镜像推送到容器注册表,那么可以以 example.com/username/repo:tag 形式指定完全限定的镜像名称 (FQIN)。在此示例中,我输入 quay.io/codezombie/demo-httpd:latest,因为我在 quay.io 上有一个名为 demo-httpd 的公共仓库。你可以按照类似的格式来指定容器注册表(Quay、Docker Hub、GitHub Container Registry 等)的 FQIN。现在,按*构建*并等待构建完成。
|
||||
|
||||
#### 推送镜像
|
||||
|
||||
构建完成后,就该推送镜像了。所以,我们需要在 Podman Desktop 中配置一个注册表。进入 Preferences->Registries 并按 *Add registry*。
|
||||
|
||||
![Add Registry 对话框][8]
|
||||
|
||||
在 “Add Registry” 对话框中,输入你的注册表服务器地址和用户凭据,然后单击 “ADD REGISTRY”。
|
||||
|
||||
现在,我回到镜像列表中的镜像,并按下上传图标将其推送到仓库。当你将鼠标悬停在设置中添加的注册表名称开头的镜像名称上时(此演示中的 quay.io),镜像名称旁边会出现一个推送按钮。
|
||||
|
||||
![将鼠标悬停在镜像名称上时出现的按钮][9]
|
||||
|
||||
![镜像通过 Podman Desktop 推送到仓库][10]
|
||||
|
||||
图像被推送后,任何有权访问镜像仓库的人都可以拉取它。由于我的镜像仓库是公开的,因此你可以轻松地将其拉入 Podman Desktop。
|
||||
|
||||
#### 拉取镜像
|
||||
|
||||
因此,为确保一切正常,请在本地删除此镜像并将其拉入 Podman Desktop。在列表中找到图像并按*删除*图标将其删除。删除图像后,单击 *Pull Image* 按钮。在 *Image to Pull* 输入完全限定名称,然后按 *Pull image*。
|
||||
|
||||
![Our container image is successfully pulled][11]
|
||||
|
||||
#### 创建一个容器
|
||||
|
||||
作为 Podman Desktop 演示的最后一部分,让我们从镜像中启动一个容器并检查结果。我转到 *Containers* 并按 *Create Container*。这将打开一个包含两个选项的对话框:*From Containerfile/Dockerfile* 和 *From existing image*。按下 *From existing image*。这将进入镜像列表。在那里,选择我们要拉取的图像。
|
||||
|
||||
![在 Podman Desktop 中创建容器][12]
|
||||
|
||||
现在,我们从列表中选择我们最近拉取的图像,然后按它前面的 *Play* 按钮。在出现的对话框中,我输入 demo-web 作为*容器名*,输入 8000 作为*端口映射*,然后按下 *Start Container*。
|
||||
|
||||
![Container configuration][13]
|
||||
|
||||
容器开始运行,我们可以通过运行以下命令检查 Apache 服务器的默认页面:
|
||||
|
||||
```
|
||||
curl http://localhost:8000
|
||||
```
|
||||
|
||||
![可以工作!][14]
|
||||
|
||||
你还应该能够在容器列表中看到正在运行的容器,其状态已更改为 *Running*。在那里,你会在容器前面找到可用的操作。例如,你可以单击终端图标打开 TTY 进入到容器中!
|
||||
|
||||
![][15]
|
||||
|
||||
### 接下来是什么
|
||||
|
||||
Podman Desktop 还很年轻,处于[积极开发][16]中。 GitHub 上有一个项目[路线图][17],其中列出了令人兴奋的按需功能,包括:
|
||||
|
||||
* Kubernetes 集成
|
||||
* 支持 Pod
|
||||
* 任务管理器
|
||||
* 卷支持
|
||||
* 支持 Docker Compose
|
||||
* Kind 支持
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/manage-containers-on-fedora-linux-with-podman-desktop/
|
||||
|
||||
作者:[Mehdi Haghgoo][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/powergame/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2022/09/podman-desktop-on-fedora-816x345.jpg
|
||||
[2]: https://github.com/marhkb/pods
|
||||
[3]: https://github.com/iongion/podman-desktop-companion
|
||||
[4]: https://github.com/cockpit-project/cockpit/
|
||||
[5]: https://podman-desktop.io/
|
||||
[6]: https://github.com/containers/podman-desktop/releases/
|
||||
[7]: https://fedoramagazine.org/wp-content/uploads/2022/08/pd.png
|
||||
[8]: https://fedoramagazine.org/wp-content/uploads/2022/08/registry.png
|
||||
[9]: https://fedoramagazine.org/wp-content/uploads/2022/08/image.png
|
||||
[10]: https://fedoramagazine.org/wp-content/uploads/2022/08/Screenshot-from-2022-08-27-23-51-38.png
|
||||
[11]: https://fedoramagazine.org/wp-content/uploads/2022/08/image-2.png
|
||||
[12]: https://fedoramagazine.org/wp-content/uploads/2022/08/image-3.png
|
||||
[13]: https://fedoramagazine.org/wp-content/uploads/2022/08/image-5.png
|
||||
[14]: https://fedoramagazine.org/wp-content/uploads/2022/08/image-6.png
|
||||
[15]: https://fedoramagazine.org/wp-content/uploads/2022/09/image-2-1024x393.png
|
||||
[16]: https://github.com/containers/podman-desktop
|
||||
[17]: https://github.com/orgs/containers/projects/2
|
Loading…
Reference in New Issue
Block a user