Skip to main content

what is docker?

Prelogue:

I was hearing about kubernetes application in cloud for quite a bit of time now and have been feeling low about not understanding what kubernetes is. So I headed over to linkedin learning, the awesome platform to learn about kubernetes. But kubernetes courses showed understanding of docker as a pre-requisite. So I started to learn about docker.

Introduction:

                               Photo by Andy Li on Unsplash

In this post, I want to provide you a preliminary understanding of what is docker and a container; and maybe a basic introduction of few usage and concepts. This is the first part of the learn-docker series I am writing, along with my own learning curve in understanding docker, container, containerization and other processes. Now let's get started with our learning.

what is docker?

Docker is a utility which carves up your computer into small sealed containers which are isolated from outside worlds. It contains its own code, env and all. It also builds these containers for you. It gets the code to and from you. It also opens you up to a social platform where you can find such containers and work on them.

what is a container?

it is a bundle of self sufficient software. it contains everything needed to run on its own. including:

(1) code (2) config files (3) dependencies installed (4) processes (5) networking for talking to other containers (6) even the part of operating system it needs to run

so basically docker takes your code and env and all resources as mentioned and seals it into a container. As well as docker runs multiple such containers in its carved up places, manages the server; and finally tears the whole thing down when work is done. 

Installing docker-ce in your machine:

If you are using mac or pc, then you have to install docker desktop. Follow this official link for downloading docker desktop. In case of linux machines, it is easy to install docker from terminal using repository method. Follow this official link to get it installed. There can be some problems for download. Follow this stackoverflow discussion.

One and first use of docker:

Not many people let's say use linux machines all the time. So what they may do is that they will run a linux virtual machine using docker. Now you may think that docker is the vm but no. Docker is the software which hosts and holds that vm in your machine and runs it. we will run a small docker program named hello-world.

Troubleshoot:

It may have been the case that you got an error something similar to this:

docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.
follow this link, if you don't want to use simple solution of adding sudo before your statement. The risk in the following of the solution mentioned in stackoverflow is that you may have to reboot or log off from your machine; which maynot be a very good choice for you. 

Whatever, you must have solved the docker issue and now you must have run the command:

sudo docker run hello-world

This, if your docker doesn't have hello-world downloaded, then will fetch from remote and download, then run. The sign that it has run is the message

"hello from docker!" which pops up in your console.


 The same thing can be done writing the command in a mac terminal if you are using the mac or if you are using windows then in your command prompt. If you are facing a socket not found or related issue in mac, then see if your docker desktop is running completely. If it is, it will show that in the top right corner icon. 

Now to see a collection of basic usage and commands of docker; write $docker in your terminal. something like this will come up:


 If you write $docker info (or sudo docker info for non-root users),then all client and server descriptions and informations will come up.


what is docker id?

 I will finish this introductory part by saying one more thing. Docker comes with a online portal too. You can host unlimited public repository  and one private repository to host your docker images; using free docker id. You can think about it as a github like platform but for docker images and containers. You should build your docker id now as later on we'll create images and upload them in public repositories in our docker accounts.

Note this, docker id may sound like something you need to find and enter; but docker id is just the username you put. So give a fancy docker id as you wish!

Our next post on this series focuses about docker images.It is yet to come. I am loosely following the learning from linkedin learning's Arthur ulfeldt's course. I will highly recommend his course along side my documents. Thanks for reading! leave a comment below if you like the content!

Comments

Popular posts from this blog

Tinder bio generation with OpenAI GPT-3 API

Introduction: Recently I got access to OpenAI API beta. After a few simple experiments, I set on creating a simple test project. In this project, I will try to create good tinder bio for a specific person.  The abc of openai API playground: In the OpenAI API playground, you get a prompt, and then you can write instructions or specific text to trigger a response from the gpt-3 models. There are also a number of preset templates which loads a specific kind of prompt and let's you generate pre-prepared results. What are the models available? There are 4 models which are stable. These are: (1) curie (2) babbage (3) ada (4) da-vinci da-vinci is the strongest of them all and can perform all downstream tasks which other models can do. There are 2 other new models which openai introduced this year (2021) named da-vinci-instruct-beta and curie-instruct-beta. These instruction models are specifically built for taking in instructions. As OpenAI blog explains and also you will see in our

Can we write codes automatically with GPT-3?

 Introduction: OpenAI created and released the first versions of GPT-3 back in 2021 beginning. We wrote a few text generation articles that time and tested how to create tinder bio using GPT-3 . If you are interested to know more on what is GPT-3 or what is openai, how the server look, then read the tinder bio article. In this article, we will explore Code generation with OpenAI models.  It has been noted already in multiple blogs and exploration work, that GPT-3 can even solve leetcode problems. We will try to explore how good the OpenAI model can "code" and whether prompt tuning will improve or change those performances. Basic coding: We will try to see a few data structure coding performance by GPT-3. (a) Merge sort with python:  First with 200 words limit, it couldn't complete the Write sample code for merge sort in python.   def merge(arr, l, m, r):     n1 = m - l + 1     n2 = r- m       # create temp arrays     L = [0] * (n1)     R = [0] * (n

What is Bort?

 Introduction: Bort, is the new and more optimized version of BERT; which came out this october from amazon science. I came to know about it today while parsing amazon science's news on facebook about bort. So Bort is the newest addition to the long list of great LM models with extra-ordinary achievements.  Why is Bort important? Bort, is a model of 5.5% effective and 16% total size of the original BERT model; and is 20x faster than BERT, while being able to surpass the BERT model in 20 out of 23 tasks; to quote the abstract of the paper,  ' it obtains performance improvements of between 0 . 3% and 31%, absolute, with respect to BERT-large, on multiple public natural language understanding (NLU) benchmarks. ' So what made this achievement possible? The main idea behind creation of Bort is to go beyond the shallow depth of weight pruning, connection deletion or merely factoring the NN into different matrix factorizations and thus distilling it. While methods like knowle