Skip to content

A simple SSH server implemented in a Docker container based on Alpine Linux. This server allows users to connect via SSH with customizable usernames and passwords, making it ideal for development and testing environments.

License

Notifications You must be signed in to change notification settings

amhoba2014/lightweight-docker-ssh-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Simple SSH Server in Docker

This repository provides a Docker image for a simple SSH server based on Alpine Linux. The server allows users to connect via SSH with a specified username and password. This setup is ideal for development and testing purposes.

Features

  • Lightweight base image using Alpine Linux.
  • Supports user-defined usernames and passwords.
  • Allows SSH access with password authentication.
  • Automatically displays the container's IP address upon startup.
  • Simple to build and run with Docker.

Getting Started

Prerequisites

  • Docker installed on your machine.
  • Basic knowledge of Docker commands.

How To Just Run

Just run the following commands to start using it right away (or move on to the next step to build it yourself):

docker pull ghcr.io/amhoba2014/lightweight-docker-ssh-server ;
docker run --rm -it -p 2222:22 ghcr.io/amhoba2014/lightweight-docker-ssh-server:latest ;

Building the Docker Image

To build the Docker image, clone this repository and navigate to its directory:

git clone https://github.com/amhoba2014/lightweight-docker-ssh-server
cd lightweight-docker-ssh-server

Then, build the image using the following command. You can specify a custom username and password using build arguments:

docker build --build-arg USERNAME=myuser --build-arg PASSWORD=mypassword -t ssh-server .

If you want to use the default username (user) and password (user), simply run:

docker build -t ssh-server .

Running the Docker Container

To run the container, use the following command:

docker run --rm -it -p 2222:22 ssh-server

This command will start the SSH server and map port 2222 on your host to port 22 in the container.

Connecting to the SSH Server

Once the container is running, you will see output similar to:

SSH server is starting. Container IP address: <container_ip>
You can now connect using ssh user@<container_ip> with password: user

To connect to the SSH server, use an SSH client (like OpenSSH) from your terminal:

ssh user@<container_ip> -p 2222

You will be prompted to enter the password. Use the password you specified during the build process or the default password (user).

Security Considerations

This SSH server configuration is intended for development and testing purposes only. It is not secure for production environments due to:

  • Password authentication being enabled.
  • Root login being disabled (though root access may still be possible through other means).

For production use, consider implementing key-based authentication and further hardening your SSH server configuration.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request if you have suggestions or improvements.

Acknowledgements


Feel free to modify this README as needed, especially sections like "License" or "Contributing" based on your project's specifics. Happy coding!

About

A simple SSH server implemented in a Docker container based on Alpine Linux. This server allows users to connect via SSH with customizable usernames and passwords, making it ideal for development and testing environments.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages