Docker on a Chromebook on Crostini - Neverware CloudReady is ready

Chrome OS is not just for kids and coffee tables. It can provide a useful Linux platform too.

Crostini brings a secure linux environment to Chrome OS.  Sophisticated development and deployments can be created with Docker containers running inside in this environment.  Chrome OS is capable of running Anaconda, Jupyter notebooks and other containers on many different developer machines. I run CloudReady Chrome OS on a Dell E7x40 to great effect. 





References

Install and run Docker in Crostini

All testing was done on CloudReady running on a Dell E7240. I was able to run anaconda/Python and other docker-compose using docker-compose.yml files my github that I had built for Mac and PC. The steps update docker to the latest ce version and docker-compose to the latest version available at this time, 1.24.0.


StepAction
Enable Linux (Beta) AKA Crostini
Enable Linux BetaMenu --> settings -- Linux (Beta)
Open Linux TerminalEnable Linux Beta
Install / upgrade docker
Remove old dockersudo apt remove docker docker-engine docker.io containerd runc
Install Dockersudo apt update
sudo apt install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/debian \
   $(lsb_release -cs) \
   stable"
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io
Enable non-root docker sudo usermod -aG docker $USER
sudo chmod 666 /var/run/docker.sock
Verify dockerdocker run ps
docker run hello-world
Upgrade docker-compose
Remove old docker-composesudo apt remove docker-compose
Install docker-composesudo curl -L https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Verify docker-composedocker-compose --version
Connecting Chrome to exposed Docker endpoints
Try DNS / hostnamePoint Chrome at http://penguin.linux.test:<port_address>/<url>
  • Chromebooks expose the containers on
    • localhost
  • Older versions of chrome OS exposed local services on these names which all work from the crosh shell
    • penguin.linux.test
    • penguin.termina.linux.test
  • Use the IP address if none of the hostnames names work. 
IP Address Point Chrome at http://<that_ip>:<port_address>/<url>
  • Find the IP address.
    • open a Crostini terminal window 
    • $ sudo ifconfig eth0
  • or
    • Open crosh with ctrl-alt-t
    • $ shell
    • $ sudo tail /etc/hosts

Connecting Chrome to exposed Docker apps

Docker runs in/on the Penguin container. The Penguin container is visible to Crosh and Chrome as an IP address.  Docker processes can expose ports to their host, Penguin/Crostini in this case. This means Docker exposes the to Chrome or Crosh on the Penguin container IP address.

Dynamic DNS entries for penguin/crostini/docker exist in /etc/hosts at the crosh prompt.  The address in /etc/hosts can be used by chrome to make a connection to the docker apps exposed ports

Docker container ports are exposed on a network visible to Crostini and thus to Crosh and

Sophisticated Capabilities

Here is the deployment topology on my machine after deploying a couple of services on Docker on Crostini on Termina on a Chromebook running CloudReady.
IP address may differ between installations

Visual Studio Code integration.

Visual Studio Code runs on Chromebooks on Crostini where it can be used to develop code and manage/view Docker containers.  The VSCode Docker Extension lets you manage docker images and processes using the Visual Studio GUI.

Video Demonstration


Neverware native Docker with Flatpack 

Never home edition can run Docker containers without or outside of the Crostini environment. It lets users run Flatpack docker applications.  This configuration only exists on CloudReady home and is not a standard Chromebook feature.

Change Log

Created 2020 03

Comments

  1. Fantastic work! Thank you.

    ReplyDelete
  2. excellent, thanks!

    one minor correction - i think "docker run ps" should be "docker ps"

    ReplyDelete
  3. Than you for this information. Why with the installation of DynamoDB Local (Amazon image) with Docker, the URL http: //localhost: 8000/shell is OK and this one http: //localhost:8000 returns an error ERR_INVALID_RESPONSE?

    ReplyDelete

Post a Comment

Popular posts from this blog

Installing the RNDIS driver on Windows 11 to use USB Raspberry Pi as network attached

Understanding your WSL2 RAM and swap - Changing the default 50%-25%

Almost PaaS Document Parsing with Tika and AWS Elastic Beanstalk