Tuesday, April 7, 2020

Docker Concepts

What is docker

Docker is basically a software containerizing software. It is more like using a Virtual machine (VM), but with more advantages than using a VM.

Virtualization

Separate environments are needed to deploy and test applications, to avoid risks of damages and losses in a real environment.
Virtual machines or VMs introduced to avoid this problem. If something wrong happens in VM, just remove and create a new one

Docker vs VM

VM is just like running another machine (guest) on top of your machine (host). It simply denotes when you run a Ubuntu VM with NodeJS server on a Windows host machine, it totally costs resources like CPU, RAM, disk amount, which is needed to run two separate Windows and Ubuntu machines with its software.


(image credits: https://www.guru99.com/docker-tutorial.html)

In the same scenario above, when we are using docker, it needs only NodeJS image and a container (explained in a moment)

Glossary

Image - It is like a class in OOP. Basically defines the software attributes, resource levels permitted to use
Container - It is like an object in OOP. Container is an instance of Image. There can be multiple containers from same image. We interact with containers when executing docker
Registry - All the docker images are stored in docker registry. Docker users can get and push images to use in projects. Public and private registries are available to store images

Why Docker

Docker containers run on top of the host's Operation system.
Docker containers run in an isolated environment on top of the host's OS
Can run more containers on the same infrastructure than running more Virtual machines
Images, containers, Network interfaces are shareable
Only essential programs can be used in images, while removing unwanted programs
Easy to add and remove software from system


Disadvantages

Graphical Applications not work well
Containers are not speed as host machine installed applications
Some container products don't work with other ones
All of the data inside a container disappears forever when the container shuts down unless we use a persistent storage location





Sunday, April 5, 2020

How to use 'Dialog 4G router' sim in mobile phone

Disclaimer: This is not an attempt of hacking a router or a misusing a service provider's resources. Whole purpose of this tutorial is knowledge sharing on how to overcome below mentioned problems. This is not guaranteed that it works on any mobile device. Be kind to use this tutorial only for educational purposes.

If you are a user with a Dialog 4g router, worst problem is you need to carry the router and its adapter wherever you go and, finding a square ping socket to plug it. And during power failures this router cannot be operated unless you use a UPS.
Now you can avoid these problems if you have a mobile phone which is capable of accessing LTE networks. So the router's sim can be inserted to mobile phone and use its data connection in your phone or using the phone as a mobile hotspot with dialog 4G sim inserted.

For this demonstration I used a Xiaomi redmi note 8 phone. You can use any phone with following specifications.
  • Supporting LTE networks. ( we want 2300 Mhz LTE band 40 )
  • Supports to use only LTE network (access has to be restricted for 2G and 3G)
  • Mini sim slot (I had to cut the existing sim as a nano sim to use with my phone)
First we need to verify the SIM is working as expected in the Dialog 4G router. This is the screenshot when our demonstration SIM was used with Dialog 4G router


Insert the dialog 4G sim to your phone. Then select preferred network type as "LTE only". You can dial *#*#4636#*#* (or *#*#4636*#*#) to get this menu.
This pic was taken after completing the tutorial.

Then,
"settings" ->
"SIM cards & Mobile networks" ->
"SIM1" or "SIM2" depending your sim slot ->
"Mobile networks"
Note: This path may be different depending your phone brand & OS

First try to use auto network connect with LTE only mode. It may correctly connect to Dialog 4G network.
If not try to connect to mobile network manually. This is the result list I got after selecting only LTE networks in my phone, and doing a network scan.



41311 is the MNC/MCC number for dialog 4G.
https://www.apnsettings.org/srilanka/mcc-mnc-code-for-sirlanka/

Wait even it connected to Dialog 4G mobile network, still you don't have internet access, obviously only Emergency calls are allowed.
You need to set APN settings as following.
Name: any_name;
APN: <empty>

But your phone won't allow to save an empty apn. So you need to type a 'space' in APN field and save it.

Now it establishes a data connection.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5pymYQA18dE7CLTLs8US1agSprH6-6GxhDFL3iZjrBTVt3VmIyTc6i2Tn4IDYkoZ-7-QhFQHpKSaiiUHHRlztvafWFvacHJgPH86-FijvjRV2EBlfLYiBVdKXaQPbaw0QeT4ULa8qPIC0/s1600/afterconnectLTEonly.jpg


Now you can see you are connected to 4G data network. Anyway you cannot use voice and sms using this 4G sim. If you have a dual sim phone, you can use the other sim slot for voice and sms.