https://github.com/amhoba/lightweight-docker-ssh-server
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.
https://github.com/amhoba/lightweight-docker-ssh-server
alpine development docker openssh server ssh testing
Last synced: 11 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/amhoba/lightweight-docker-ssh-server
- Owner: amhoba
- License: mit
- Created: 2024-12-19T18:28:28.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-21T19:21:14.000Z (over 1 year ago)
- Last Synced: 2025-04-08T22:47:37.058Z (about 1 year ago)
- Topics: alpine, development, docker, openssh, server, ssh, testing
- Language: Dockerfile
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://www.docker.com/get-started) 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):
```bash
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:
```bash
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:
```bash
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:
```bash
docker build -t ssh-server .
```
### Running the Docker Container
To run the container, use the following command:
```bash
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:
You can now connect using ssh user@ with password: user
```
To connect to the SSH server, use an SSH client (like OpenSSH) from your terminal:
```bash
ssh user@ -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](LICENSE) file for details.
## Contributing
Contributions are welcome! Please open an issue or submit a pull request if you have suggestions or improvements.
## Acknowledgements
- [Alpine Linux](https://alpinelinux.org/) for providing a lightweight base image.
- [OpenSSH](https://www.openssh.com/) for secure shell access.
---
Feel free to modify this README as needed, especially sections like "License" or "Contributing" based on your project's specifics. Happy coding!