How Do You Use docker-compose?

Problem scenario
You want to create an example of a docker compose file.  How do you use docker-compose?

Prerequisites
i.  This assumes you have Docker installed and running.  If you need assistance, see this posting.
ii.  This assumes that you have installed docker-compose.  If you need assistance, see this posting.
iii.  This assumes the Docker host has access to the internet.

How Do You Get Jenkins Working in a Docker Container?

One of the following problems apply:

Problem scenario #1
You have no idea how to start Jenkins in a Docker container.  What should you do?

OR

Problem scenario #2
You have run some Docker commands to try to start deploy Jenkins in a container.  You get output like this:

[4213] [10236] Disconnected
[9146] Connection from [::1]:41118
[9146] Extended attributes (16 bytes) exist <host=localhost>

How Do You Run a Docker Container as a Non-root User?

Problem scenario
You run this command: docker run -it ubuntu bash

docker: Got permission denied while trying to connect to the Docker daemon sockes/create: dial unix /var/run/docker.sock: connect: permission denied.

You do not want to run a Docker container as a privileged user (as a recommended practice).  What should you do?

Solution
Background: “To do builds in the cluster,

How Do You Troubleshoot Connecting to a Docker Registry when You Receive an Error Response from a Daemon about an “i/o timeout”?

Problem scenario
You run a command like this: docker login docker.artifactory

You receive a message like this:
“Error response from daemon: Get https://docker.artifactory:80/v1/users/: dial tcp x.x.x.x:443: i/o timeout”

What should you do?

Solution
Make sure there is no firewall or security group blocking connectivity from the client reaching the Docker registry.  Even if you are running the “docker registry” command from the back-end of the Docker registry server itself,

Why Cannot You Upload Different Docker Images to a Given Docker Repository?

Problem scenario
You have a Docker repository.  You know its name in the Docker registry.  You are having trouble uploading different images to the repository.  What should you do?

Solution
You must use a different Docker repository for each image.  A repository can only hold different versions of the same image.  But only one image can be stored in a repository. 

How Do You Troubleshoot the kubectl Message “Connection error: Unable to connect to the server:” with AWS?

Problem scenario
You are using Kubernetes in AWS.  When using a kubectl command you get this error: “Connection error: Unable to connect to the server:  getting credentials: exec: exit status 1  … Could not get token: AccessDenied: Access denied”

What should you do?

Possible Solution #1
Was the user who created the Kubernetes cluster a different user from the user that is configured with your AWS CLI?

How Do You Use Amazon Elastic Kubernetes Service with the CLI?

Problem scenario
You want to deploy Kubernetes to AWS.  How do you use Amazon EKS to create a cluster with the AWS CLI?

Solution
Prerequisites

i.  This assumes that your AWS CLI has been installed.  If you need assistance with this, see this posting.
ii.  This assumes that you have a role created.  If you need assistance with this, see this posting.

How Do You Create an AWS User with Web Console Access to View EKS Clusters in the AWS Console?

One of the following problem scenarios apply.

Problem scenario #1
You want an AWS user to be able to log into the web console and view EKS clusters.  How do you do this?

OR

Problem scenario #2
You are using AWS and when you log into the AWS Console via a web browser with a user who is a member of a Group with two EKS policies,

How Do You Use Amazon Elastic Kubernetes Service with the Web UI?

Problem scenario
You want to deploy a Kubernetes cluster in AWS.  How do you use Amazon EKS with the web UI?

Solution
Prerequisites

i.  Optional:  It is recommended to create a separate VPC for each cluster (according to Amazon’s documentation here).  If you need to create a VPC, see this posting.

ii.  You need a Linux server with kubectl installed on it.