docker-sshd
Synopsis
This docker container runs sshd
so that ssh
and scp
can be used for remote access.
Overview
In many cases, the functionality of ssh
and scp
are already supported.
Examples:
- Docker:
docker exec
anddocker cp
- Kubernetes:
kubectl exec
andkubectl cp
- OpenShift:
oc exec
andoc cp
But there are environments where there is no ability to "exec" nor "cp".
In these environments, a senzing/sshd
docker container can be used provide "exec" and "cp" capabilities
via ssh
and scp
.
Examples:
- AWS Elastic Container Service (ECS)
Contents
Legend
- 🤔 - A "thinker" icon means that a little extra thinking may be required. Perhaps there are some choices to be made. Perhaps it's an optional step.
- ✏️ - A "pencil" icon means that the instructions may need modification before performing.
⚠️ - A "warning" icon means that something tricky is happening, so pay attention.
Expectations
- Space: This repository and demonstration require 1 GB free disk space.
- Time: Budget 40 minutes to get the demonstration up-and-running, depending on CPU and network speeds.
- Background knowledge: This repository assumes a working knowledge of:
Demonstrate using Docker
Prerequisites for Docker
🤔 The following tasks need to be complete before proceeding. These are "one-time tasks" which may already have been completed.
- The following software programs need to be installed:
SSH port
🤔 Normally port 22 is already in use for ssh
.
So a different port may be needed by the running docker container.
-
🤔 Optional: See if port 22 is already in use. Example:
sudo lsof -i -P -n | grep LISTEN | grep :22
-
✏️ Choose port for docker container. Example:
export SENZING_SSHD_PORT=922
-
Construct parameter for
docker run
. Example:export SENZING_SSHD_PORT_PARAMETER="--publish ${SENZING_SSHD_PORT:-22}:22"
Set sshd password
🤔 Optional The default password set for the sshd containers is senzingsshdpassword
. However, this can be set by setting the following variable
✏️ Set the SENZING_SSHD_PASSWORD
variable to change the password to access the sshd container
export SENZING_SSHD_PASSWORD=<Pass_You_Want>
Run Docker container
Although the Docker run
command looks complex,
it accounts for all of the optional variations described above.
Unset *_PARAMETER
environment variables have no effect on the
docker run
command and may be removed or remain.
-
Run Docker container. Example:
sudo docker run \ --env ROOT_PASSWORD=${SENZING_SSHD_PASSWORD} \ --interactive \ --rm \ --tty \ ${SENZING_SSHD_PORT_PARAMETER} \ senzing/sshd
SSH into container
-
✏️ Identify the host running the
senzing/sshd
container. Example:SENZING_SSHD_HOST=localhost
-
ssh
into the running docker container. Example:ssh root@${SENZING_SSHD_HOST} -p ${SENZING_SSHD_PORT:-22}
-
The default password is
senzingsshdpassword
. However, if the docker image was built locally, it may have been changed duringdocker build
. See Build Docker Image. -
🤔 Optional: If
senzing/sshd
has been deployed multiple times, the following message may appear whenssh
-ing into the container:@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
This is a good thing, it's mean to prevent man-in-the-middle attacks. However in this case, it prevents access to ever-changing docker containers. The message usually shows a remedy. Example:
ssh-keygen -f "/home/senzing/.ssh/known_hosts" -R "[localhost]:922"
Configuration
Configuration values specified by environment variable or command line parameter.
License
View license information for the software container in this Docker image. Note that this license does not permit further distribution.
This Docker image may also contain software from the Senzing GitHub community under the Apache License 2.0.
Further, as with all Docker images, this likely also contains other software which may be under other licenses (such as Bash, etc. from the base distribution, along with any direct or indirect dependencies of the primary software being contained).
As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.
References
- Development
- Errors
- Examples
- Related artifacts