Chromebooks are great mobile devices because they’re simple to use, secure and fast. Because of those reasons, Chromebooks could make for outstanding development devices. And if Docker is your development environment of choice, you’re in luck. Thanks to Linux, it’s possible to install Docker on ChromeOS so you can work your container dev magic on the go with ease.
I’m going to show you how to install Docker on ChromeOS, a task you should be able to complete in a few short minutes.
SEE: Hiring kit: Back-end Developer (TechRepublic Premium)
What you’ll need to install Docker
To install Docker, you’ll need a Chromebook with an updated version of ChromeOS.
How to add Linux to your Chromebook
The first thing you must do is enable Linux on your Chromebook. This is done by going to Settings | Advanced | Developers. There, you’ll find Linux Development Environment listed.
Click Turn On (Figure A) and follow the on-screen instructions. This process will take a few minutes to complete but, once it’s finished, you’ll see a terminal window opened, where you can start using Linux on your Chromebook.
How to install Docker
From the now-open Linux terminal window, update apt with the command:
sudo apt-get update
Once apt has updated, install the required dependencies with the command:
sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y
With the dependencies out of the way, download and install the official Docker GPG key with:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
Add the required fingerprint:
sudo apt-key fingerprint 0EBFCD88
Add the official Docker repository with the command:
sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable”
Update apt with the command:
sudo apt-get update
Finally, install Docker with:
sudo apt-get install docker-ce docker-ce-cli containerd.io -y
Next, you need to add your user to the docker group with the command:
sudo usermod -aG docker $USER
Close the Linux terminal and log out of your Chromebook. Log back in, open the Linux terminal app and you should now be able to run the docker command without sudo, which would be a security risk.
How to test the container deployment
Test your new installation out by running the Hello World container with the command:
docker run hello-world
You should be greeted by the Hello World text in the terminal window. Another example would be deploying the NGINX container with the command:
docker run --name docker-nginx -p 8080:80 -d nginx
Test the deployment with the command:
You should see the text output of the NGINX welcome page, which includes the line “Thank you for using nginx.” You could also open the Chrome web browser on your Chromebook and point it to 0.0.0.0:8080 and see the welcome screen in the browser (Figure B).
Congratulations, you can now develop with Docker on your Chromebook. At this point, Docker should work as expected and you can build your containers and stacks as usual.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.
Subscribe to the Developer Insider Newsletter
From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays