Search code examples
podman

How to change the default Podman Machine? Ex.: From `podman-machine-default` to `myvm`


I want to keep track of different machines to be able to configure different proxys for each machine.

How can I set a new machine as Podman's default machine?

In the documentation there is podman machine init myvm to create a new machine but couldn't find any refence on how to access it.

I searched a lot to try to find this already, but no tutorial mention this, as it's kind of a uncommon use case.


Solution

  • After a lot of effort and investigation, found this:

    podman system connection default <name>
    

    This will set the default machine to the desired name.

    I also recommend checking the list before selecting the machine, as there are rootful and rootless options:

    podman system connection list
    

    Result:

    Name                         URI                                                          Identity                                      Default
    podman-machine-default       ssh://user@127.0.0.1:57864/run/user/1000/podman/podman.sock  <User>\.ssh\podman-machine-default            false
    podman-machine-default-root  ssh://root@127.0.0.1:57864/run/podman/podman.sock            <User>\.ssh\podman-machine-default            false
    

    If you don't want to change the default machine, you can also use the -c flag before the command to specify another machine:

    podman -c myvm images