How Do You Create a Dockerfile and Build a Docker Image?

Problem scenario
You know how to use Docker containers.  You know how to use Docker images if they are already built.  Now you want to use a Dockerfile to understand how to build images.  How do you use Dockerfile and how do you create your own image?

Solution

Prerequisites
This assumes you have installed Docker on your Linux server.  If you have not,

How Do You Access the Networking Port of a Docker Container When There Appears to Be No Port Mapping, Just a Single Port Exposed by Itself?

Problem scenario
You run “docker ps -a” and see values in the PORTS column.  You see values such as these for two separate containers:

Container 1 has this:  0.0.0.0:32775->5000/tcp

Container 2 has this:  5731/tcp

You cannot reach the containers that have no “->” symbol in them via web browsers or other network connectivity tools.  You can reach those containers with the “->” symbol in the PORTS value. 

How Do You Install Docker on Debian 9 in GCP?

Problem scenario
You are running Debian 9 in GCP.  You want to install Docker on this server.  What should you do?

Solution
1.  Create a script in /tmp/ call installer.sh with the following lines of content:

#!/bin/bash
apt-get -y update
apt-get install -y apt-transport-https ca-certificates wget software-properties-common
wget https://download.docker.com/linux/debian/gpg
apt-key add gpg
echo “deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable” | sudo tee -a /etc/apt/sources.list.d/docker.list
apt-get -y update
apt-cache policy docker-ce
apt-get -y install docker-ce

2. 

How Do You Install Docker on Different Distributions of Linux in Different Public Clouds or on an On-Premise Server?

Problem scenario
You want to install Docker.  You want directions for installing it with and without making changes to how packages are installed on the Linux server.  You want directions that apply to Linux servers in AWS, Azure, or GCP.  You want directions that can apply to CentOS/RHEL, SUSE, or Ubuntu.  What do you do?

Solution
Find the link below that is the most appropriate for your needs.

How Do You Deploy Graylog in a Docker Container?

Problem scenario
You want to set up (install and configure) Graylog from a Docker container.  What do you do?

Solution
1.  Verify you have a least two processors with this command:  cat /proc/cpuinfo | grep -ic processor

Was the output two or more?  If so, proceed.  If not, get a server with two processors.  If you are using an AWS EC-2 instance, see this 

How Do You Install Sysdig in a New Docker Container to Try It Out?

Problem scenario
You want to monitor Docker containers.  Therefore you want to install Sysdig to try it out.  How do you pull down a Docker container that has Sysdig installed in it?

Solution

Prerequisites
Docker needs to be installed.  If you need to install Docker on a CentOS/RedHat/Fedora distribution, see this posting.  If you need to install Docker on a Debian/Ubuntu,

How Do You Upload a Docker Image to Amazon Elastic Container Registry?

Problem scenario
You created your own Docker image.  You want to upload it to a repository so it is available to other servers.  You want to upload a Docker image from your server into ECR (in AWS).  You do not know the name of the repository.  How do you do this?

Solution
Prerequisites

a.  This assumes that ECR has been set up.  If you need assistance,

How Do You Deploy a Kubernetes Cluster in Google Cloud Platform?

Updated on 8/18/19

Problem Scenario
How do you deploy a Kubernetes cluster in Google Cloud Platform?

Solution
There are three ways to do this.  (You could use the console in a web browser.  A second way is with a command line interface method.  A third way is with a REST API.)

Possible solution #1
One way is with the console.