In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "how to use Podman to run the Linux container as a non-root user". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let the editor take you to learn how to use Podman to run the Linux container as a non-root user.
Linux containers are processes with specific isolation capabilities provided by the Linux kernel-including isolation of file systems, processes, and networks. Containers help achieve portability-applications can be distributed with their dependencies in the container image and run on almost any Linux system that has a container runtime environment.
Although container technology has existed for a long time, Linux container has been widely promoted by Docker. The word "Docker" can refer to several different things, including container technology and tools, the surrounding community, or Docker Inc. The company. However, in this article, I will refer to the techniques and tools for managing Linux containers.
What is Docker?
Docker is a daemon that runs on your system as root and uses the capabilities of the Linux kernel to manage running containers. In addition to running the container, it can also easily manage container images-- interacting with the container registry, storing images, managing container versions, and so on. It basically supports all the operations required to run a single container.
But even if Docker is a very convenient tool for managing Linux containers, it has two disadvantages: it is a daemon that needs to run on your system, and it needs to run with root privileges, which may have some security risks. However, Podman is solving these two problems.
Podman introduction
Podman is a container runtime environment that provides very similar functionality to Docker. As already indicated, it does not need to run any daemons on your system, and it can also run without root privileges. Let's look at some examples of running the Linux container using Podman.
Use Podman to run the container
Perhaps one of the simplest examples is to run the Fedora container and print "Hello world!" on the command line:
$podman run-rm-it fedora:28 echo "Hello world!"
Use generic Dockerfile to build an image in the same way as Docker:
$cat DockerfileFROM fedora:28RUN dnf-y install cowsay $podman build. -t hello-world... Output omitted... $podman run-- rm-it hello-world cowsay "Hello!"
To build the container, Podman invokes another tool called Buildah in the background. You can read a recent article about building container images using Buildah-it's not just about using typical Dockerfile.
In addition to building and running containers, Podman can also interact with container hosting. To log in to the container registry, such as the widely used Docker Hub, run:
$podman login docker.io
In order to push the image I just built, I just need to mark it to represent a specific container registry, and then push it directly.
$podman-t hello-world docker.io/asamalik/hello-world$ podman push docker.io/asamalik/hello-world
By the way, have you noticed how I run everything as a non-root user? In addition, there are no big, heavy daemons running on my system!
Install Podman
Podman is available by default on Silverblue-a new generation of Linux workstations based on container-based workflows. To install it on any version of Fedora, simply run:
Sudo dnf install podman at this point, I believe you have a better understanding of "how to use Podman to run the Linux container as a non-root user". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.