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.

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.

How To Add a Disk To a RHEL/CentOS/Fedora Server

Run these commands (with sudo in front of them or, less preferably, as the root user):
1) fdisk -l > /tmp/saveOfOutput   # This creates a baseline for step #3 below.

2)  With a physical server:  Turn off the server and connect the physical disk, and turn it back on.
With a virtual server:  Add the disk in vSphere

3)  As root, issue these commands:
fdisk -l #find added device in the output of this command
#If it is not seen,

Concerns About Creating a Docker Container With Optional Flags

Some online Docker literature suggests creating a new Docker container (e.g., the “docker run” command) with these two options:

–net=host –privileged=true

There are some caveats with these flags.  First, if you use them, within your container you can make changes to the Docker server itself.*  For some applications, this defeats Docker’s purpose.  Secondly, if the application you run in Docker becomes compromised, the entire host could be vulnerable to an attack through the Docker container.*