Monday, October 21, 2019

Using Podman Container on Endless OS to get Finance::Quote.

Endless OS came pre-installed on my acer aspire3 bought last year I started liking it but I had installed Ubuntu 18.04 in dual boot because I was not familiar with flatpak apps only type of Linux Distributions. Moreover, the main problem I noticed that the flatpak version of Gnucash did not have Finance::Quote which updates NAV of ny investments on daily basis.

I posted about this requirement on Endless OS Community and one of their developer posted on Github asking what was the program to include Finance::Quote on the flatpak version last December.

Recently I posted about this problem and I was introduced to Podman through which I built a Container with Ubuntu 19.10 mini ISO (75.2 MB).
Podman is a Cli only utility.

mkdir ~/sharing This directory will share the files on the host with Container.

podman image pull ubuntu:19.10
podman run --interactive --tty --name mycontainer\
--volume /tmp/.X11-unix:/tmp/.X11-unix \ --env DISPLAY --device /dev/dri --device /dev/snd --device /dev/input \ --volume /etc/localtime:/etc/localtime:ro \
--volume /sysroot/home/$(whoami)/sharing:/mnt ubuntu:19.10

root@ca50d6597e9c:/#
Then I created a User (Username same as on Endless OS)
root@ca50d6597e9c:/# useradd -d /home/username -s /bin/bash username mkdir -p /home/username chmod -R 700 /home/username chown -R username:users /home/username

exit

Next I installed Gnucash in the Container:
$ podman start mycontainer
$ podman exec --interactive --tty mycontainer /bin/bash
root@ca50d6597e9c:/# apt update
# apt install gnucash

Gnucash got installed pulling all its dependencies
# exit

Before running the Container I had put the file myaccount.gnucash in the ~/sharing folder.

Next I had to run Gnucash in the Container using the Display of Endless OS.
$ podman start mycontainer
$ xhost +
$ podman exec --interactive --tty --user $(whoami) --workdir /home/$(whoami) mycontainer/bin/bash

Username@ca50d6597e9c:/$ gnucash /mnt/myaccount.gnucash
Gnucash opened using Display of host.
I updated the NAVs through Tools/Price_Deskto/Get_Quotes

exit
$ podman stop mycontainer

I could have updated the NAVs through Commandline also:
Username@ca50d6597e9c:/$ gnucash --add-price-quotes /mnt/myaccount.gnucash

OR
Just typing the following on the host:
$ podman start mycontainer
$ docker exec -it mycontainer gnucash --add-price-quotes /mnt/myaccount.gnucash without using GUI.




No comments:

Air India direct flight to San Fransisco has flown through China today.

 My sister in law left for San Fransisco by AI 173 flight which flows over North Pole. I tracked that flight on flightstats.com till it land...