https://github.com/testcontainers/sshd-docker
Docker image with SSH daemon installed
https://github.com/testcontainers/sshd-docker
Last synced: 6 days ago
JSON representation
Docker image with SSH daemon installed
- Host: GitHub
- URL: https://github.com/testcontainers/sshd-docker
- Owner: testcontainers
- License: apache-2.0
- Created: 2020-05-20T10:56:24.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-24T09:15:34.000Z (12 months ago)
- Last Synced: 2024-05-22T18:21:05.427Z (11 months ago)
- Language: Dockerfile
- Homepage: https://hub.docker.com/r/testcontainers/sshd
- Size: 12.7 KB
- Stars: 5
- Watchers: 6
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- jimsghstars - testcontainers/sshd-docker - Docker image with SSH daemon installed (Dockerfile)
README
# sshd-docker
Docker image with SSH daemon installed# Usage
This container is meant to be used to expose host ports to containers running in Docker.
When using testcontainers in unit tests, refer to the documentation of testcontainers to find out how to use it:
- Java: https://java.testcontainers.org/features/networking/#exposing-host-ports-to-the-container
- .NET: https://dotnet.testcontainers.org/api/create_docker_network/#exposing-host-ports-to-the-container
- node.js: https://node.testcontainers.org/features/networking/#expose-host-ports-to-container
- Go: https://golang.testcontainers.org/features/networking/#exposing-host-ports-to-the-containerAlternatively, you can start the container yourself:
```yaml
services:
sshd:
image: testcontainers/sshd:1.2.0
environment:
PASSWORD: "SET_YOUR_PASSWORD_HERE"
ports:
- 10022:22requester:
image: curlimages/curl
command: /bin/sh -c "while true; do curl http://sshd:8080; sleep 5; done"
depends_on:
- sshd
```And connect to it via ssh:
```bash
# ssh -R [remote_port]:[destination_address]:[local_port] [username]@[ssh_server] -p [ssh_port]
ssh -R 8080:localhost:8080 root@localhost -p 10022
```Start your application and you should see requests coming from the requester service:
```bash
python3 -m http.server 8080
```