home
github icon rss icon

Open a Tab in ChromeOS from Docker

September 8, 2019

I wanted to run newsboat, a command-line RSS reader, in a Docker container on my Pixelbook. No biggie:

FROM alpine
RUN sed -i -e 's/v[[:digit:]]\.[[:digit:]]+/edge/g' /etc/apk/repositories && \
    apk update && \
    apk add newsboat && \
    rm -rf /var/cache/apk/*
ENTRYPOINT ["newsboat"]

I set up a Docker Hub autobuild and created an alias:

alias newsboat="docker run --rm -ti \
  -v ${HOME}/.newsboat:/root/.newsboat \
  bakerba/newsboat"

I fired it up, opened the first article, hit o to open it in Chrome, and… nothing happened. I don’t know why I thought that would work, after all I just tried to open up a new tab in the host of a container inside a container inside a virtual machine.

Google failed me here. Or I failed at Google. I’m a Docker noob, is there a Docker idiom for accomplishing this? Do real programmers use lynx?

I learned that Project Crostini containers communicate with the host through a daemon called garcon. The garcon binaries are bind-mounted from the VM to Crostini containers, so I figured I could bind-mount them to my container as well:

alias newsboat="docker run --rm -ti \
  -v ${HOME}/.newsboat:/root/.newsboat \
  -v /opt/google/cros-containers:/opt/google/cros-containers:ro \
  -v /dev/.host_ip:/dev/.host_ip \
  -v /dev/.container_token:/dev/.container_token \
  bakerba/newsboat"

And in my newsboat config:

browser "/opt/google/cros-containers/bin/garcon --client --url %u"

And voilà, my newsboat container can open a new tab in Chrome. Now on to mutt!

Up Next: Easy Meter Integration with rtlamr + Home Assistant

Previous: Building a Smart Garage Opener

comments powered by Disqus