LinuxCommandLibrary

podman-machine

Manage virtual machines for Podman

TLDR

List existing machines

$ podman machine ls
copy

Create a new default machine
$ podman machine init
copy

Create a new machine with a specific name
$ podman machine init [name]
copy

Create a new machine with different resources
$ podman machine init --cpus=[4] --memory=[4096] --disk-size=[50]
copy

Start or stop a machine
$ podman machine [start|stop] [name]
copy

Connect to a running machine via SSH
$ podman machine ssh [name]
copy

Inspect information about a machine
$ podman machine inspect [name]
copy

SYNOPSIS

podman-machine [command] [options]

PARAMETERS

create
    Creates a new Podman-compatible virtual machine.

rm
    Removes an existing Podman virtual machine.

start
    Starts a stopped Podman virtual machine.

stop
    Stops a running Podman virtual machine.

restart
    Restarts a running Podman virtual machine.

inspect
    Displays detailed information about a Podman virtual machine.

ssh
    Connects to a Podman virtual machine via SSH.

ls
    Lists available Podman virtual machines.

env
    Displays environment variables for accessing the Podman virtual machine.

--cpus
    Number of CPUs to allocate to the VM.

--memory
    Amount of memory (e.g., 2GB) to allocate to the VM.

--disk-size
    Size of the disk image for the VM.

DESCRIPTION

The `podman-machine` command is designed to simplify the management of virtual machines required by Podman on macOS and Windows systems. Since Podman relies on a Linux kernel, it necessitates a virtual machine environment on operating systems lacking a native Linux kernel. `podman-machine` automates the creation, deletion, starting, stopping, and overall configuration of these virtual machines. It abstracts away the complexities of manually setting up and maintaining a Linux VM, making it easier for users to run containerized applications using Podman on non-Linux platforms. It provides a user-friendly interface for configuring resources like CPU, memory, and disk space allocated to the VM. Users can utilize this tool to create multiple VMs with diverse configurations to suit specific application requirements. Also, the podman-machine creates a container connection automatically to run podman commands inside of the VM and exposes it for the main machine.

CAVEATS

The `podman-machine` command relies on virtualization technology (e.g., HyperKit, QEMU) being properly installed and configured on the host system. Firewall settings and network configurations may need adjustments to allow proper communication with the virtual machine. It may require administrator privileges for certain operations.

NETWORKING

The command automatically configures a network connection between the host and the VM. The default network is typically a NAT network, allowing the VM to access the internet through the host's network interface. Specific port forwarding can be configured through manual settings or other tools.

STORAGE

The VM's disk image is stored on the host system. The `--disk-size` parameter controls the maximum size of this image. Data persistence depends on the configured storage drivers and volumes within the containers running inside the VM.

TROUBLESHOOTING

Common issues include insufficient resources allocated to the VM (CPU, memory, disk space), networking problems preventing container access, and conflicts with other virtualization software.

Consult the Podman documentation for detailed troubleshooting steps.

HISTORY

The `podman-machine` command was introduced to address the challenge of running Podman on macOS and Windows, which lack a native Linux environment. It has evolved alongside Podman to provide a streamlined user experience for creating and managing the necessary virtual machines, replacing or simplifying previous manual setup processes. Its development is directly tied to Podman's goal of offering a containerization solution that is platform-independent.

SEE ALSO

podman(1), docker(1)

Copied to clipboard