How to install Docker on a Compute Engine
Installing Docker on a compute engine using simple and easy steps.
PermalinkOverview
The DevOps model's development aims to integrate techniques from software development and IT management. The DevOps approach offers speed as its crucial benefit over conventional system development.
DevOps may shorten the time needed to design a system when properly used and facilitate continuous delivery. Businesses that employ the development operations approach may boost productivity while maintaining excellent software quality.
In this article, you will learn all you need to know about Docker, why developers love using it, and finally how to install it on a computing machine.
Sounds good? let's get to work.
PermalinkWhat is Docker?
The Docker Inc. company created Docker, a free piece of software. After being unveiled to the public on March 13, 2013, it has since evolved into a need in IT development.
Users can run and deploy their apps from completely separate and segregated contexts. Containers are then used to describe these contexts.
Thanks to this, a container may then be executed on any system by the developer.
As you can see, Docker solves any compilation or dependency issues. Your application will start running right away after you've launched your container.
PermalinkIs Docker a virtual machine?
One of the most frequent questions concerning Docker is presented here. Actually, no, that's not quite the answer.
Although it can appear to be a virtual computer at first glance, the functioning is different.
A virtual machine, unlike Docker, will have an entire operating system. It will function autonomously and behave like a computer.
Docker will share only the host machine's resources to operate its environments.
PermalinkWhy developers love Docker
This technology might significantly change a developer's everyday routine. I have included a non-exhaustive list of the advantages you will discover below to help my best respond to your query:
A virtual machine cannot be created or destroyed as quickly as a container.
There will be no more issues setting up your workspace. You won't ever need to reinstall your dependencies again after Docker is enabled manually. You only need to provide them with your setup whenever you switch computers or hire a new employee.
You maintain a tidy workspace since each environment is separate and may be deleted without affecting the others.
Deploying your project on your server will simplify publishing it online.
Docker is fast. Your program may start and end in a matter of seconds as opposed to a virtual machine.
Multi-platform is Docker. Your container may be launched on any system.
PermalinkCreating a Compute Engine VM
If you don't have a Google Cloud account, get one. Remember that you may test the platform out and play about with it as much as you like with a $300 free credit valid for 90 days.
Go to the Compute Engine website after creating your account, then select Create Instance. Any Name, Region, or Zone will do. Prices in some areas vary from one another.
From the E2 series, I selected the e2-highmem-8 machine type. If you'd like, you may choose an alternative option.
Allow complete access to all Cloud APIs, enable display devices, and permit HTTP and HTTPS transmission. Press Create.
PermalinkIncrease disk size
After installing many utilities, memory issues may occur if the disk space is not increased. When I tried to install Tensorflow, I received the error "No space left on device
" before expanding the disk capacity.
Go to the Boot disk area, click the name of the instance you just created, and then click it again. Select Edit by clicking the page's top button. Click Save after changing the size from 10 to 100. Wait until the disk has finished upgrading. In my instance, the "updating the disk" notice lingered longer than expected. Simply reload the page.
PermalinkInstalling Docker
To log in to your VM from the VM instances page, click the SSH button on the instance.
It's usually a good idea to update things. Specify the commands:
$ sudo apt update
$ sudo apt upgrade
To set up Docker:
$ sudo apt install docker.io
After installation, run:
$ docker
If a lot of things appear, your installation was successful.
$ sudo docker run hello-world
The hello-world picture won't be located locally or downloaded from the internet. It will then use the image to build and operate a container. A message beginning "Hello from Docker!" should appear.
PermalinkAdding the user to the Docker group
You should add your current user to the group docker if you don't want to have to type sudo
before each command when using Docker.
Type the commands:
$ sudo groupadd docker
$ sudo usermod -aG docker $USER
$ newgrp docker
Docker commands can now be executed without the sudo
command. Try it:
$ docker run hello-world
And that's it; you have finally been able to install Docker on a compute engine.
PermalinkConclusion
This short tutorial looked into Docker, an open platform for creating, distributing, and executing programs. You may divide your apps from your infrastructure with the help of Docker, allowing for rapid software delivery. You can manage your infrastructure using Docker in the same manner that you manage your apps. You may drastically shorten the time between developing and executing code in production by rapidly using Docker's methodology for shipping, testing, and deploying code.