Chromium Kiosk/ Balena project not saving cookies

I’m running chromium browser in kiosk mode in a docker container. The page loads a login screen. You sign in and the page gives you a cookie so that you never have to login again. The set up all seems to work fine except for saving cookies which is crucial for this. I’m wondering where this is going wrong. I’m using the balena project found below:

here on github.

Maybe I need to try changing my flags on start up? right now they are:

chromium-browser --kiosk --disable-infobars $URL_LAUNCHER_URL --disable-gpu

The site that it opens into to is not a local one but instead a remote site at an ip address. so the issue is not the common file:// prefix I’ve seen so much of when researching this. I am going to an actual site.

I have to use chromium because wpe/webkit doesn’t support autoplay for videos :frowning:

I tried using this project here to see if it was specific to the build or chromium. This project runs firefox but cookies don’t seem to persist here either.

Is there something about a virtual environment like docker where data doesn’t persist?

Some logs from chromium although they seem unrelated:

X.Org X Server 1.20.4
29.01.20 12:53:06 (-0800)  browser  X Protocol Version 11, Revision 0
29.01.20 12:53:06 (-0800)  browser  Build Operating System: Linux 4.15.0-48-generic armv8l Raspbian
29.01.20 12:53:06 (-0800)  browser  Current Operating System: Linux bk-rpi-629ec76 4.19.71 #1 SMP Mon Jan 6 19:29:19 UTC 2020 armv7l
29.01.20 12:53:06 (-0800)  browser  Kernel command line: coherent_pool=1M 8250.nr_uarts=0 bcm2708_fb.fbwidth=1080 bcm2708_fb.fbheight=1920 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  dwc_otg.lpm_enable=0 console=null rootfstype=ext4 rootwait vt.global_cursor_default=0 root=PARTUUID=0653c4e0-02 rootwait
29.01.20 12:53:06 (-0800)  browser  Build Date: 05 June 2019  12:49:54PM
29.01.20 12:53:06 (-0800)  browser  xorg-server 2:1.20.4-1+rpt1 (https://www.debian.org/support) 
29.01.20 12:53:06 (-0800)  browser  Current version of pixman: 0.36.0
29.01.20 12:53:06 (-0800)  browser      Before reporting problems, check http://wiki.x.org
29.01.20 12:53:06 (-0800)  browser      to make sure that you have the latest version.
29.01.20 12:53:06 (-0800)  browser  Markers: (--) probed, (**) from config file, (==) default setting,
29.01.20 12:53:06 (-0800)  browser      (++) from command line, (!!) notice, (II) informational,
29.01.20 12:53:06 (-0800)  browser      (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
29.01.20 12:53:06 (-0800)  browser  (==) Log file: "/var/log/Xorg.0.log", Time: Wed Jan 29 20:53:06 2020
29.01.20 12:53:06 (-0800)  browser  (==) Using system config directory "/usr/share/X11/xorg.conf.d"
29.01.20 12:53:21 (-0800)  browser  [139:366:0129/205321.397269:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
29.01.20 12:53:21 (-0800)  browser  [139:366:0129/205321.741725:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
29.01.20 12:53:21 (-0800)  browser  [139:366:0129/205321.742165:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
29.01.20 12:53:22 (-0800)  browser  [139:380:0129/205322.697631:ERROR:object_proxy.cc(632)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
29.01.20 12:53:22 (-0800)  browser  [139:380:0129/205322.700946:ERROR:object_proxy.cc(632)] Failed to call method: org.freedesktop.UPower.GetDisplayDevice: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
29.01.20 12:53:22 (-0800)  browser  [139:380:0129/205322.704045:ERROR:object_proxy.cc(632)] Failed to call method: org.freedesktop.UPower.EnumerateDevices: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files

Hey @KingstonSteele

It looks like the session data or cookies are not persisted across restarts. I have not tried it myself, but yes perhaps you need to add flags to either specify the user profile directory or user data directory. Perhaps the --user-data-dir flag might be worth looking into? You could set the path to a persistent volume. See the chromium docs for more details

Let us know if this works for you.
Regards
Rahul

The solutions was this:

start.sh

...
chromium-browser --user-data-dir=/usr/src/app/cookies
...

docker-compose

version: '2'
volumes:
    cookies:
services:
   browser:
    build: ./browser
    privileged: true
    volumes:
      - 'cookies:/usr/src/app/cookies'