podman
Table of Content
podman¶
https://podman.io/
https://docs.podman.io/en/latest/
preparing VM¶
set-location f:\hyperv
$VMName = "podman-vm"
$Switch = 'External VM Switch'
$BasePath = "F:\hyperv"
$VMPath = "$BasePath\vm"
$VHDPath = "$BasePath\vhd"
# choose the installation media
$InstallMedia = "F:\hyperv\install_media\debian-12.6.0-amd64-netinst.iso"
$VM = @{
Name = $VMName
MemoryStartupBytes = 8GB
Generation = 2
NewVHDPath = "$VHDPath\$VMName.vhdx"
NewVHDSizeBytes = 50GB
Path = "$VMPath\$VMName"
SwitchName = $Switch
}
# create the VM
New-VM @VM
# give it 4 cores
Set-VMProcessor $VMName -Count 4
# Set 4GB memory
Set-VMMemory -VMName $VMName -MinimumBytes 4GB -MaximumBytes 8GB
# secure boot settings
Set-VMFirmware -VMName $VMName -SecureBootTemplateId "272e7447-90a4-4563-a4b9-8e4ab00526ce"
# Add DVD Drive to Virtual Machine
Add-VMScsiController -VMName $VMName
Add-VMDvdDrive -VMName $VMName -ControllerNumber 1 -ControllerLocation 0 -Path $InstallMedia
# Mount Installation Media
$DVDDrive = Get-VMDvdDrive -VMName $VMName
# Configure Virtual Machine to Boot from DVD
Set-VMFirmware -VMName $VMName -FirstBootDevice $DVDDrive
# run the VM and complete initial setup
# create checkpoint
Checkpoint-VM -Name $VMName -SnapshotName init
# restore checkpoint
Restore-VMCheckpoint -Name init -VMName $VMName -Confirm:$false
# clean up
$VMName = "podman-vm"
Stop-VM -Name $VMName
Remove-VM -Name $VMName
set-location $BasePath
Remove-Item "vhd/$VMName.vhdx"
Remove-Item "vm/$VMName"
installation¶
https://podman.io/docs/installation
apt¶
https://itslinuxguide.com/install-podman-debian/
echo 'deb http://download.opensuse.org/repositories/home:/alvistack/Debian_12/ /' | sudo tee /etc/apt/sources.list.d/home:alvistack.list
curl -fsSL https://download.opensuse.org/repositories/home:alvistack/Debian_12/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_alvistack.gpg > /dev/null
sudo apt update
sudo apt install podman
build from the source¶
# requirements
sudo apt update
sudo apt install \
btrfs-progs \
crun \
git \
golang-go \
go-md2man \
iptables \
libassuan-dev \
libbtrfs-dev \
libc6-dev \
libdevmapper-dev \
libglib2.0-dev \
libgpgme-dev \
libgpg-error-dev \
libprotobuf-dev \
libprotobuf-c-dev \
libseccomp-dev \
libselinux1-dev \
libsystemd-dev \
netavark \
pkg-config \
uidmap
# conmon
git clone https://github.com/containers/conmon
cd conmon
export GOCACHE="$(mktemp -d)"
sudo apt install build-essential
make
sudo make podman
# configuration files
sudo mkdir -p /etc/containers
sudo apt install curl
sudo curl -L -o /etc/containers/registries.conf https://src.fedoraproject.org/rpms/containers-common/raw/main/f/registries.conf
sudo curl -L -o /etc/containers/policy.json https://src.fedoraproject.org/rpms/containers-common/raw/main/f/default-policy.json
# optional package
sudo apt install libapparmor-dev
# build podman
git clone https://github.com/containers/podman/
cd podman
make BUILDTAGS="selinux seccomp" PREFIX=/usr
# install the latest version of go and try again
sudo apt remove golang-go
cd
wget https://go.dev/dl/go1.23.0.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.23.0.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin # and add this in the .bashrc file as necessary
cd ~/podman
make BUILDTAGS="selinux seccomp" PREFIX=/usr
sudo make install PREFIX=/usr
cd
git clone git://passt.top/passt && sudo make -C passt install
# too many errors in the documentation...
# the configuration files stored were not present on the original server
# namespaced networking error occurred when trying to run a container
# crun/runc error occurred after installing passt/pasta for ns networking...