changed 4 years ago
Linked with GitHub

Spin a virtual machine using podman in a minute

[chandankumar@fedora playbooks]$ podman machine -h
Manage a virtual machine

Description:
  Manage a virtual machine. Virtual machines are used to run Podman.

Usage:
  podman machine [command]

Available Commands:
  init        Initialize a virtual machine
  list        List machines
  rm          Remove an existing machine
  ssh         SSH into an existing machine
  start       Start an existing machine
  stop        Stop an existing machine

[chandankumar@fedora playbooks]$ podman machine init test_quickstart
Downloading VM image: fedora-coreos-34.20210725.1.0-qemu.x86_64.qcow2.xz: done  
Extracting compressed file
[chandankumar@fedora playbooks]$ podman machine list
NAME              VM TYPE     CREATED        LAST UP
test_quickstart*  qemu        5 seconds ago  5 seconds ago
[chandankumar@fedora playbooks]$ podman machine start test_quickstart
Waiting for VM ...
[chandankumar@fedora playbooks]$ podman machine ssh test_quickstart
Connecting to vm test_quickstart. To close connection, use `~.` or `exit`
The authenticity of host '[localhost]:34373 ([127.0.0.1]:34373)' can't be established.
ED25519 key fingerprint is SHA256:gFzyduoX28wYrLtLmYEBU/bOtKI6TadcBkBy2SgcVdg.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[localhost]:34373' (ED25519) to the list of known hosts.
Fedora CoreOS 34.20210725.1.0
Tracker: https://github.com/coreos/fedora-coreos-tracker
Discuss: https://discussion.fedoraproject.org/c/server/coreos/

[core@localhost ~]$ cat /etc/redhat-release 
Fedora release 34 (Thirty Four)
[core@localhost ~]$ 

Hey! Wait dnf is not there, use rpm-ostree

[core@localhost ~]$ sudo rpm-ostree install dnf
Checking out tree a7e7779... done
Enabled rpm-md repositories: fedora-cisco-openh264 updates fedora updates-archive
Updating metadata for 'fedora-cisco-openh264'... done
rpm-md repo 'fedora-cisco-openh264'; generated: 2021-02-23T00:49:00Z
Updating metadata for 'updates'... done
rpm-md repo 'updates'; generated: 2021-08-05T00:52:16Z
⠙ Updating metadata for 'fedora'  95% [███████████████████░] (0s) 
Updating metadata for 'fedora'... done
rpm-md repo 'fedora'; generated: 2021-04-23T10:47:57Z
Updating metadata for 'updates-archive'... done
rpm-md repo 'updates-archive'; generated: 2021-08-05T01:50:52Z
Importing rpm-md... done
Resolving dependencies... done
Will download: 28 packages (17.3 MB)
Downloading from 'updates'... done
Downloading from 'fedora'... done
Importing packages... done
Checking out packages... done
Running pre scripts... done
Running post scripts... done
Running posttrans scripts... done
Writing rpmdb... done
Writing OSTree commit... done
Staging deployment... done
Added:
  deltarpm-3.6.2-8.fc34.x86_64
  dnf-4.8.0-1.fc34.noarch
  dnf-data-4.8.0-1.fc34.noarch
  gdbm-libs-1:1.19-2.fc34.x86_64
  ima-evm-utils-1.3.2-2.fc34.x86_64
  libcomps-0.1.17-1.fc34.x86_64
  libdnf-0.63.1-1.fc34.x86_64
  libxcrypt-compat-4.4.23-1.fc34.x86_64
  python-pip-wheel-21.0.1-3.fc34.noarch
  python-setuptools-wheel-53.0.0-2.fc34.noarch
  python-unversioned-command-3.9.6-2.fc34.noarch
  python3-3.9.6-2.fc34.x86_64
  python3-dbus-1.2.18-1.fc34.x86_64
  python3-dnf-4.8.0-1.fc34.noarch
  python3-gpg-1.15.1-2.fc34.x86_64
  python3-hawkey-0.63.1-1.fc34.x86_64
  python3-libcomps-0.1.17-1.fc34.x86_64
  python3-libdnf-0.63.1-1.fc34.x86_64
  python3-libs-3.9.6-2.fc34.x86_64
  python3-pip-21.0.1-3.fc34.noarch
  python3-rpm-4.16.1.3-1.fc34.x86_64
  python3-setuptools-53.0.0-2.fc34.noarch
  python3-unbound-1.13.1-1.fc34.x86_64
  rpm-build-libs-4.16.1.3-1.fc34.x86_64
  rpm-plugin-systemd-inhibit-4.16.1.3-1.fc34.x86_64
  rpm-sign-libs-4.16.1.3-1.fc34.x86_64
  sqlite-3.34.1-2.fc34.x86_64
  unbound-libs-1.13.1-1.fc34.x86_64
Run "systemctl reboot" to start a reboot
[core@localhost ~]$ 
[core@localhost ~]$ sudo systemctl reboot

Now dnf is there, Let's re enter and do all fun stuff but it fails at gpg check and but need to stick with rpm-ostree

[chandankumar@fedora playbooks]$ podman machine ssh test_quickstart
Connecting to vm test_quickstart. To close connection, use `~.` or `exit`
Fedora CoreOS 34.20210725.1.0
Tracker: https://github.com/coreos/fedora-coreos-tracker
Discuss: https://discussion.fedoraproject.org/c/server/coreos/

Last login: Thu Aug  5 12:37:52 2021 from 10.0.2.2
[core@localhost ~]$ sudo dnf install wget
Select a repo