https://github.com/robertdebock/docker-centos-openssh
A CentOS 7 container that runs openssh server
https://github.com/robertdebock/docker-centos-openssh
bats centos docker docker-centos-openssh openssh ssh-key
Last synced: 6 months ago
JSON representation
A CentOS 7 container that runs openssh server
- Host: GitHub
- URL: https://github.com/robertdebock/docker-centos-openssh
- Owner: robertdebock
- License: apache-2.0
- Created: 2016-04-19T06:01:03.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-02-29T10:51:11.000Z (over 1 year ago)
- Last Synced: 2025-04-20T10:16:43.724Z (6 months ago)
- Topics: bats, centos, docker, docker-centos-openssh, openssh, ssh-key
- Language: Shell
- Size: 103 KB
- Stars: 16
- Watchers: 2
- Forks: 16
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# docker-centos-openssh
A CentOS container that runs openssh server.
[](https://travis-ci.com/robertdebock/docker-centos-openssh) [](http://microbadger.com/images/robertdebock/docker-centos-openssh "Get your own image badge on microbadger.com")
You can use this container to quickly startup a "machine" and test things, or it can be used as an SSH server, maybe a stepstone.
This container will generate new keys (host and user) at startup if none are loaded by attaching a volume.
## Running the container.
It's quite easy to start a container:
```bash
docker run -P robertdebock/docker-centos-openssh
```For Podman, please use:
```bash
podman run --cap-add AUDIT_WRITE -P robertdebock/docker-centos-openssh
```(The `--cap-add AUDIT_WRITE` is added to overcome an [issue](https://bugzilla.redhat.com/show_bug.cgi?id=1923728).)
A private key will be displayed, copy-pasts-save it, set the permissions to 0600.Find out what port Docker has connected to the container:
```bash
docker port docker-centos-openssh
```And connect to the container:
```bash
ssh -p ${port} -i ${savedkey} root@${ip}
```The ${ip} depends on where the container is running.
## Using your own private key
Simply save your key in a folder like "dot-ssh" and map the volumes:
```bash
docker run -P -v $(pwd)/./ssh:/root/.ssh/ robertdebock/docker-centos-openssh
```## Using with docker-compose
You may setup a testlab, for example for Ansible or Rundeck, using Docker-compose, like so:
```yaml
version: '3'
services:
server:
image: robertdebock/docker-centos-openssh
volumes:
- /path/to/dot-ssh:/root/.ssh/
links:
- client1
- client2
- client3
ports:
- "2222:22"
client1:
image: robertdebock/docker-centos-openssh
volumes:
- /path/to/dot-ssh:/root/.ssh/
client2:
image: robertdebock/docker-centos-openssh
volumes:
- /path/to/dot-ssh:/root/.ssh/
client3:
image: robertdebock/docker-centos-openssh
volumes:
- /path/to/dot-ssh:/root/.ssh/
```# Technologies used to build and test
- [Travis CI](https://travis-ci.com/robertdebock/docker-centos-openssh) is used to build, run and test the image.
- [Docker Hub](https://hub.docker.com/r/robertdebock/docker-centos-openssh/) is used to deploy the image to.Building on Travis CI and publishing to Docker Hub happens in parallel. On Travis CI, few project are used:
- [Bats](https://github.com/sstephenson/bats) for testing.
- [Docker Lint](https://github.com/projectatomic/dockerfile_lint) for finding weird errors.A bit weird about this setup is that when the build fails, an image is still published.