What Are The Differences between CMD and ENTRYPOINT in Docker?

Question
Dockerfile has reserved words CMD and ENTRYPOINT.  They seem to do the same thing.  What are the differences between CMD and ENTRYPOINT in Docker besides their words’ lengths?

Answer
There are many similarities between these two reserved words in Dockerfile “language.”  But here are three differences:

#1  “…CMD can be overwritten by an argument to docker run, while ENTRYPOINT can be overwritten only by using the –entrypoint option of docker run.” is a quote taken from page 43 of 

How Do You Install docker-compose on Any Distribution of Linux?

Problem scenario
You want a Bash script to install Docker on any distribution of Linux.  You want to use the same script for each Linux server.  How do you write a script that will install docker-compose on any type of Linux including CentOS/RHEL/Fedora, Debian/Ubuntu and Linux SUSE?

Solution
Overview

This will work with AWS or Azure servers or on-premise servers.  It requires that the server have access to the internet.

How Do You Use a Dockerfile with Reserved Words ENTRYPOINT and CMD to Create an Image and Test It Out?

Problem scenario
You want to use the ENTRYPOINT and CMD keywords in a Dockerfile.  You know that the value of CMD amounts to a parameter for the ENTRYPOINT value which is executed.  You want to verify that the value of ENDPOINT is used in an execution.  You want the Dockerfile to be simple to illustrate these reserved words.  What do you do?

Solution
Prerequisite
Install Docker. 

What Is The Difference between a Kubernetes Service, the Kubelet, and the Kubernetes API?

Question
You know of different Kubernetes components: the Kubernetes Service, the Kubelet, and the Kubernetes API.  What do these components do and how are they different?

Answer
A Kubernetes service is an entity, that may span nodes, that keeps a group of Pods functional and coherent (paraphrased from this site).  A “[s]ervice will get its own IP address and port” as quoted from page 339 of Kubernetes in Action

What Is The Difference between kubeadm and kubectl?

Problem scenario
Both kubeadm and kubectl are tools and commands for Kubernetes.  What are the differences between them?

Answer
kubeadm is for creating new Kubernetes clusters (as paraphrased from this Kubernetes.io page).  The command can be used to create both master nodes as well as worker nodes (taken from pg 575 Kubernetes in Action).

kubectl is for running operations on one or more existing Kubernetes clusters (as paraphrased from this 

How Do You Fix the Problem When You Get “docker command not found”?

Problem scenario
Docker is installed as far as you can tell on your Linux server.  You ran “sudo apt-get -y install docker” and it seemed to work.  When you run it again you see this:

“Building dependency tree
Reading state information… Done
docker is already the newest version (1.5-1+b1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

How do you get Docker to work when it seems installed but you get the error “docker command not found”?

How Do You Pronounce quay.io?

Problem scenario
You are interested in the quay.io to store Docker images. You do not know how to say the term “quay” as in “quay.io.” How should it be pronounced?

Answer
The word “quay” is pronounced “kway” (rhymes with stray). (The pronunciation “key” may be acceptable too.) If you want to see the source, click on this external page:
https://developers.redhat.com/blog/2019/06/26/using-quay-io-to-find-vulnerabilities-in-your-container-images/

How Do You Troubleshoot the Kubernetes Error “Metrics not available or pod default/kubia-xxx-bmb”?

Problem scenario
You run “kubectl top pod” but you receive an error such as this:

‘Metrics not available or pod default/kubia-xxx-bmb, age: 1hr10m…   error: Metrics not available for pod default/kubia-xxx-bmb, age: 1hr10m”‘

What should you do?

Updated on 9/2/19.

Solution
Wait five minutes.  Then re-run this command: kubectl top pod

The source of this question and answer were taken from page 432 of Kubernetes in Action by Marko Luksa published in 2018 by Manning. 

What Is the Difference between a Node and a Pod in Kubernetes?

Question
You are using Kubernetes.  You read about Nodes and Pods.  What is the difference?

Answer
A Pod is a collection of one or more containers (e.g., Docker or rkt containers).  A node is a server that is the home of one or more Pods.

“A Node is a worker machine in Kubernetes and may be either a virtual or a physical machine…” (taken from 

How Do You Find the Number of Active Connections That an Nginx HTTP Load Balancer Has?

Problem scenario
You have an Nginx instance configured to be an HTTP load balancer (aka invisible landing page, pass-through distributor or reverse proxy).  You want to analyze the inbound web traffic that your Nginx server is currently receiving.  How do you find out how many active connections there are through the load balancer?

Solution
1.  Modify the /etc/nginx/conf.d/default.conf file in the Nginx HTTP load balancer.