How Do You Troubleshoot the Docker problem “Error response from daemon: Cannot start container”?

Problem scenario
Sometimes you try to start a Docker container but there is a problem.  For example you try:
docker start <containerID
But you receive this: “Error response from daemon: Cannot start container <containerID: failed to create endpoint <nameon network bridge: ip tables failed: iptables –wait -t nat -A DOCKER -p tcp -d 0/0 –dport 80 -j DNAT –to-destination x.x.x.x:80 ! -i docker0: iptables: No chain/target/match by that name.”

Solution
cd /var/lib/docker/network/files/
ls -lh /tmp/forposterity
mkdir /tmp/backupdir
mv /var/lib/docker/network/files/ /tmp/backupdir
systemctl restart docker
 #change this command depending on your distribution and version of Linux to restart Docker services

How To Port Forward (redirect traffic destined for an IP address to a specific port)

Scenario:  On a Linux server, it can be useful to send traffic destined to a certain IP address to a different port on the server.  The listening service could be unique insofar as its port number has been designated.  The listening service could be a Docker container or a guest virtual machine.
Method:  iptables -t nat -A PREROUTING -i eth3 -p tcp –dport 80 -j DNAT –to 91.91.91.91:81
Explanation: 

Saving a Docker Image and Using It On A Different Server

Problem Scenario
Sometimes the “docker save” command does not work as you would expect.  You run the command on a Docker host, but it does not work.  You might even try the -o flag or the –output=/tmp/destinationFileName.tar option.  But the response may be an surprising error “Cowardly refusing to save to a terminal. Use the -o flag or redirect.”  You want to copy a Docker image from one machine to another computer but problems get in your way. 

How To Import A Copy of An Existing GitLab project

Problem scenario:  You want to copy a GitLab project from one instance of GitLab to a new instance of GitLab.  The Git repository you want to copy to a new GitLab server is not presented via the git://, http://, nor https:// protocols.    

Prerequisites:  You have root access to the back end of the server with the GitLab.

Method of Solution:
1) 

How To Enter the Web UI of Gitlab CE without Setting Up Its Backend Email

Problem scenario:  When you bring up the web UI for GitLab CE (Community Edition) for the first time, you are prompted to enter a new password twice.  This password will be for the admin@example.com username.  If someone else set it up and failed to provide you with the username, and the back end email has not been configured, follow these directions.
Prerequisite:  You must have root access.
Solution: 

Having Two Docker Containers Share A Directory on the Host

Goal: You want two Docker containers to use the same file share on the Docker server from time to time.  

Problem/Error blocking goal:  In a Docker container, when you try to change directories to a directory that is on the Docker host (e.g., the docker container was created with the –volume flag), and you get an error “bash: cd <directoryname> permission denied,” you have to run two commands to fix it. 

How To Fix a Docker Container That Is Giving An Error ‘exec “bash”: executable file not found in $PATH’

Normally you can enter a Docker container with this command:
docker exec -it <containerIDbash
It is possible you receive an error that says ‘exec “bash”: executable file not found in $PATH’
The root cause could be related to insufficient disk space on the Docker host.  Delete files or otherwise make room (e.g., add disk space).  Then stop the container with this command: docker stop <containerID
Finally,

How Do You Solve a Yum Install/Update Error That Says “Failed to connect to … connection refused”?

Problem:  When trying to use yum commands with a repository on your network, you receive “Failed to connect to x.x.x.x:80; Connection refused” (where x.x.x.x is the IP address of the yum repository server).  What are some possible solutions to this problem?

Potential solutions:
1)  Verify the Linux server with the repository has a valid repository created.  Use “createrepo <directoryToRPMfiles>”

2) 

How To Have The Apache Service Automatically Start When Its Docker Container Is Started

Goal:  To have Apache start when a Docker container starts running do the following (for Docker containers based on RHEL/CentOS/Fedora). 

Prerequisite:  The Docker container was created with the “-p 80:80” flag.  Other port numbers besides 80 will work.  The port numbers do not have to be the same.  They can be any number between 1 and 65535.  If there is no binding of the Docker host’s TCP ports to the container,

How A Docker Container and Its Server Can Share a Directory

Create the Docker Container with this:

docker run -i -v /absolute/path/on/DockerHost:/absolute/path/in/Docker/Container -t repositoryName /bin/bash

where “/absolute/path/on/DockerHost” is the path and directory on the Docker server that will be presented to the Docker container in the location of “/absolute/path/in/Docker/Container.”

The “repositoryName” in the example is found by running this command: docker images
In the results of this command under the left-hand column are the potential repositoryName values.

Be advised that the /absolute/path/in/Docker/Container will have its contents obliterated when the Docker container is created.