Ubuntu-20.04 安装 podman

1 What is Podman?

Podman is a daemonless, open source, Linux native tool designed to make it easy to find, run, build, share and deploy applications using Open Containers Initiative (OCI) Containers and Container Images. Podman provides a command line interface (CLI) familiar to anyone who has used the Docker Container Engine. Most users can simply alias Docker to Podman (alias docker=podman) without any problems. Similar to other common Container Engines (Docker, CRI-O, containerd), Podman relies on an OCI compliant Container Runtime (runc, crun, runv, etc) to interface with the operating system and create the running containers. This makes the running containers created by Podman nearly indistinguishable from those created by any other common container engine.

Containers under the control of Podman can either be run by root or by a non-privileged user. Podman manages the entire container ecosystem which includes pods, containers, container images, and container volumes using the libpod library. Podman specializes in all of the commands and functions that help you to maintain and modify OCI container images, such as pulling and tagging. It allows you to create, run, and maintain those containers and container images in a production environment.

There is a RESTFul API to manage containers. We also have a remote Podman client that can interact with the RESTFul service. We currently support clients on Linux, Mac, and Windows. The RESTFul service is only supported on Linux.

If you are completely new to containers, we recommend that you check out the Introduction. For power users or those coming from Docker, check out our Tutorials. For advanced users and contributors, you can get very detailed information about the Podman CLI by looking at our Commands page. Finally, for Developers looking at how to interact with the Podman API, please see our API documentation Reference.
podman

2 查看 Ubuntu 版本信息

root@ubuntu:~# cat /proc/version
Linux version 5.8.0-49-generic (buildd@lgw01-amd64-055) (gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #55~20.04.1-Ubuntu SMP Fri Mar 26 01:01:07 UTC 2021

3 访问 Podman 主页

查看 Podman 主页 按照自己的系统安装。

. /etc/os-release
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key | sudo apt-key add -
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install podman
# (Ubuntu 18.04) Restart dbus for rootless podman
systemctl --user restart dbus

4 安装 Podman

root@ubuntu:~# . /etc/os-release
root@ubuntu:~# echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/ /
root@ubuntu:~# curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key | sudo apt-key add -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1093  100  1093    0     0   1125      0 --:--:-- --:--:-- --:--:--  1124
OK
root@ubuntu:~# sudo apt-get update
Hit:1 http://mirrors.aliyun.com/ubuntu focal InRelease
Hit:2 https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal InRelease             
Hit:3 http://mirrors.aliyun.com/ubuntu focal-security InRelease                     
Hit:4 http://mirrors.aliyun.com/ubuntu focal-updates InRelease
Hit:5 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:6 http://mirrors.aliyun.com/ubuntu focal-proposed InRelease
Hit:7 http://mirrors.aliyun.com/ubuntu focal-backports InRelease
Get:8 https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04  InRelease [1,642 B]
Get:9 https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04  Packages [12.5 kB]
Get:10 https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/testing/xUbuntu_20.04  InRelease [1,637 B]
Get:11 https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/testing/xUbuntu_20.04  Packages [13.8 kB]
Fetched 29.5 kB in 3s (10.4 kB/s)      
Reading package lists... Done
root@ubuntu:~# sudo apt-get -y upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  slirp4netns
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 707 kB of archives.
After this operation, 2,012 kB of additional disk space will be used.
Get:1 https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04  slirp4netns 100:1.1.8-3 [707 kB]
Fetched 707 kB in 2s (323 kB/s)      
(Reading database ... 263746 files and directories currently installed.)
Preparing to unpack .../slirp4netns_100%3a1.1.8-3_amd64.deb ...
Unpacking slirp4netns (100:1.1.8-3) over (0.4.3-1) ...
Setting up slirp4netns (100:1.1.8-3) ...
Processing triggers for man-db (2.9.1-1) ...
root@ubuntu:~# service podman start
Failed to start podman.service: Unit podman.service not found.
root@ubuntu:~# apt install -y podman
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  catatonit conmon containernetworking-plugins containers-common criu crun fuse-overlayfs fuse3 libfuse3-3 libnet1 libprotobuf-c1 podman-plugins uidmap
The following packages will be REMOVED:
  fuse
The following NEW packages will be installed:
  catatonit conmon containernetworking-plugins containers-common criu crun fuse-overlayfs fuse3 libfuse3-3 libnet1 libprotobuf-c1 podman podman-plugins uidmap
0 upgraded, 14 newly installed, 1 to remove and 0 not upgraded.
Need to get 28.1 MB of archives.
After this operation, 143 MB of additional disk space will be used.
Get:1 http://mirrors.aliyun.com/ubuntu focal/universe amd64 libfuse3-3 amd64 3.9.0-2 [74.0 kB]
Get:2 http://mirrors.aliyun.com/ubuntu focal/universe amd64 fuse3 amd64 3.9.0-2 [24.7 kB]
Get:3 http://mirrors.aliyun.com/ubuntu focal/main amd64 libnet1 amd64 1.1.6+dfsg-3.1build1 [43.3 kB]
Get:4 http://mirrors.aliyun.com/ubuntu focal/universe amd64 libprotobuf-c1 amd64 1.3.3-1 [18.9 kB]
Get:5 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 uidmap amd64 1:4.8.1-1ubuntu5.20.04 [26.3 kB]
Get:6 https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04  catatonit 0.1.5~1 [275 kB]
Get:7 https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04  conmon 100:2.0.27-1 [31.5 kB]
Get:8 https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04  containers-common 100:1-14 [49.0 kB]
Get:9 https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04  criu 3.15-1 [635 kB]
Get:10 https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04  crun 100:0.18-3 [242 kB]
Get:11 https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/testing/xUbuntu_20.04  fuse-overlayfs 100:1.4.0-3 [41.4 kB]
Get:12 https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04  podman-plugins 100:1.2.0-1 [1,035 kB]
Get:13 https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/testing/xUbuntu_20.04  podman 100:3.1.0-3 [18.2 MB]
Get:14 https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04  containernetworking-plugins 100:0.9.1-1 [7,342 kB]         
Fetched 28.1 MB in 16s (1,720 kB/s)                                                                                                                             
Selecting previously unselected package libfuse3-3:amd64.
(Reading database ... 263745 files and directories currently installed.)
Preparing to unpack .../libfuse3-3_3.9.0-2_amd64.deb ...

Progress: [  0%] [...........................................................................................................................................] 
Unpacking libfuse3-3:amd64 (3.9.0-2) ........................................................................................................................] 

dpkg: fuse: dependency problems, but removing anyway as you requested:.......................................................................................] 
 xdg-desktop-portal depends on fuse; however:
  Package fuse is to be removed.
 ntfs-3g depends on fuse.
 gvfs-fuse depends on fuse.

(Reading database ... 263753 files and directories currently installed.)
Removing fuse (2.9.9-3) ...

Progress: [  5%] [#######....................................................................................................................................] 
update-initramfs: deferring update (trigger activated).......................................................................................................] 
Selecting previously unselected package fuse3.
(Reading database ... 263743 files and directories currently installed.)
Preparing to unpack .../00-fuse3_3.9.0-2_amd64.deb ...

Unpacking fuse3 (3.9.0-2) ...................................................................................................................................] 

Selecting previously unselected package catatonit............................................................................................................] 
Preparing to unpack .../01-catatonit_0.1.5~1_amd64.deb ...

Unpacking catatonit (0.1.5~1) ...#...........................................................................................................................] 

Selecting previously unselected package conmon...............................................................................................................] 
Preparing to unpack .../02-conmon_100%3a2.0.27-1_amd64.deb ...

Unpacking conmon (100:2.0.27-1) ...####......................................................................................................................] 

Selecting previously unselected package containers-common....................................................................................................] 
Preparing to unpack .../03-containers-common_100%3a1-14_all.deb ...

Unpacking containers-common (100:1-14) ...#..................................................................................................................] 

Selecting previously unselected package libnet1:amd64........................................................................................................] 
Preparing to unpack .../04-libnet1_1.1.6+dfsg-3.1build1_amd64.deb ...

Unpacking libnet1:amd64 (1.1.6+dfsg-3.1build1) ..............................................................................................................] 

Selecting previously unselected package libprotobuf-c1:amd64.................................................................................................] 
Preparing to unpack .../05-libprotobuf-c1_1.3.3-1_amd64.deb ...

Unpacking libprotobuf-c1:amd64 (1.3.3-1) ...#########........................................................................................................] 

Selecting previously unselected package criu.##########......................................................................................................] 
Preparing to unpack .../06-criu_3.15-1_amd64.deb ...

Unpacking criu (3.15-1) ...###############################...................................................................................................] 

Selecting previously unselected package crun.###############.................................................................................................] 
Preparing to unpack .../07-crun_100%3a0.18-3_amd64.deb ...

Unpacking crun (100:0.18-3) ...###############################...............................................................................................] 

Selecting previously unselected package fuse-overlayfs.##########............................................................................................] 
Preparing to unpack .../08-fuse-overlayfs_100%3a1.4.0-3_amd64.deb ...

Unpacking fuse-overlayfs (100:1.4.0-3) ...#########################..........................................................................................] 

Selecting previously unselected package podman-plugins.##############........................................................................................] 
Preparing to unpack .../09-podman-plugins_100%3a1.2.0-1_amd64.deb ...

Unpacking podman-plugins (100:1.2.0-1) ...##############################.....................................................................................] 

Selecting previously unselected package podman.###########################...................................................................................] 
Preparing to unpack .../10-podman_100%3a3.1.0-3_amd64.deb ...

Unpacking podman (100:3.1.0-3) ...##########################################.................................................................................] 

Selecting previously unselected package uidmap.################################..............................................................................] 
Preparing to unpack .../11-uidmap_1%3a4.8.1-1ubuntu5.20.04_amd64.deb ...

Unpacking uidmap (1:4.8.1-1ubuntu5.20.04) ...####################################............................................................................] 

Selecting previously unselected package containernetworking-plugins.###############..........................................................................] 
Preparing to unpack .../12-containernetworking-plugins_100%3a0.9.1-1_amd64.deb ...

Unpacking containernetworking-plugins (100:0.9.1-1) ...###############################.......................................................................] 

Setting up uidmap (1:4.8.1-1ubuntu5.20.04) ...##########################################.....................................................................] 

Progress: [ 53%] [#########################################################################..................................................................] 
Setting up libnet1:amd64 (1.1.6+dfsg-3.1build1) ...##########################################................................................................] 

Progress: [ 56%] [#############################################################################..............................................................] 
Setting up libprotobuf-c1:amd64 (1.3.3-1) ...#####################################################...........................................................] 

Progress: [ 59%] [##################################################################################.........................................................] 
Setting up conmon (100:2.0.27-1) ...##################################################################.......................................................] 

Progress: [ 63%] [#######################################################################################....................................................] 
Setting up containernetworking-plugins (100:0.9.1-1) ...###################################################..................................................] 

Progress: [ 66%] [###########################################################################################................................................] 
Setting up catatonit (0.1.5~1) ...##############################################################################.............................................] 

Progress: [ 69%] [################################################################################################...........................................] 
Setting up containers-common (100:1-14) ...#########################################################################.........................................] 

Progress: [ 73%] [#####################################################################################################......................................] 
Setting up podman-plugins (100:1.2.0-1) ...##############################################################################....................................] 

Progress: [ 76%] [##########################################################################################################.................................] 
Setting up libfuse3-3:amd64 (3.9.0-2) ...#####################################################################################...............................] 

Progress: [ 80%] [##############################################################################################################.............................] 
Setting up criu (3.15-1) ...#######################################################################################################..........................] 

Progress: [ 83%] [###################################################################################################################........................] 
Setting up crun (100:0.18-3) ...#######################################################################################################......................] 

Progress: [ 86%] [########################################################################################################################...................] 
Setting up podman (100:3.1.0-3) ...#########################################################################################################.................] 

Progress: [ 90%] [############################################################################################################################...............] 
Setting up fuse3 (3.9.0-2) ...###################################################################################################################............] 
Installing new version of config file /etc/fuse.conf ...

update-initramfs: deferring update (trigger activated)#############################################################################################..........] 

Setting up fuse-overlayfs (100:1.4.0-3) ...##########################################################################################################........] 

Progress: [ 97%] [######################################################################################################################################.....] 
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...####################################################################################################...] 
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for initramfs-tools (0.136ubuntu6.4) ...
update-initramfs: Generating /boot/initrd.img-5.8.0-49-generic
root@ubuntu:~# 

5 开机自启 podman

sudo systemctl start podman

6 查看 podman 版本

root@ubuntu:~# podman --version
podman version 3.1.0
root@ubuntu:~# 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值