lpt2007 / its-ai

its-ai
4 stars 1 forks source link

raspbarry pi - install & run chrome under docker container #5

Open lpt2007 opened 5 years ago

lpt2007 commented 5 years ago

I used raspbian-desktop from this link: https://www.raspberrypi.org/downloads/raspbian/

I enabled ssh with:

sudo systemctl enable ssh

I update host system:

sudo apt-get -y update
sudo apt-get -y upgrade

run raspi-config: sudo raspi-config

go to -> "Interfacing Options" -> "Camera" -> Enable, go to -> "Advanced Options" -> "Memory Split" -> 256 go to -> "Finish" -> "Reboot"

I installed docker:

curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh
sudo usermod -aG docker pi

I Installed x11docker:

wget https://raw.githubusercontent.com/mviereck/x11docker/master/x11docker -O /tmp/x11docker
sudo bash /tmp/x11docker --update
rm /tmp/x11docker

I create folders:

mkdir /home/pi/docker
mkdir /home/pi/docker/chrome

create and edit Dockerfile: nano /home/pi/docker/chrome/Dockerfile

add this:

FROM raspbian/stretch
RUN apt-get update && apt-get dist-upgrade -y
RUN apt-get install -y libraspberrypi0 libraspberrypi-dev libraspberrypi-doc
RUN apt-get install -y lsb-release
RUN apt-get install chromium-browser -y
CMD chromium-browser

build docker container: sudo docker build -t chrome /home/pi/docker/chrome

from ssh I run this:

sudo x11docker --pulseaudio --gpu --xorg -- --privileged -- chrome
lpt2007 commented 5 years ago

Configure Raspbian for Google Chrome: Google Chrome is CPU intensive application, therefore, we recommend to increase swap space. Open configuration file in Terminal (command line) using the following command: sudo nano /etc/dphys-swapfile Raspbian has 100MB of swap by default. You should change it to 2000MB in the configuration file. So you will have to find this line: CONF_SWAPSIZE=100 And then change it into: CONF_SWAPSIZE=2048

Then restart dphys-swapfile to apply changes: sudo /etc/init.d/dphys-swapfile stop sudo /etc/init.d/dphys-swapfile start

atzbert commented 4 years ago

I'd love to use this on my hassio installation :)