# docker4ssh - docker containers and more via ssh
**docker4ssh** is an ssh server that can create new docker containers and re-login into existing ones.
β¨ Features
Β·
β¨ Installation
Β·
ποΈ Usage
Β·
β License
**Visit the [wiki](https://github.com/ByteDream/docker4ssh/wiki) to get more information and detailed usage instructions**
## β¨ Features
- Create containers by images (e.g. `ubuntu:21.04@server`)
- Create specific containers for specific usernames with [profiles](https://github.com/ByteDream/docker4ssh/wiki/Configuration-Files#profileconf)
- Containers are configurable from within
- Re-login into existing containers
- Full use of the docker api (unlike [docker2ssh](https://github.com/moul/ssh2docker), which uses the cli, which theoretically could cause code injection)
- Highly configurable [settings](https://github.com/ByteDream/docker4ssh/wiki/Configuration-Files#docker4sshconf)
## β¨οΈ Installation
For every install method your OS **must** be linux and docker has to be installed.
- Download from the latest release (currently only x64 architecture supported)
- Download `docker4ssh-.tar.gz` from the [latest release](https://github.com/ByteDream/docker4ssh/releases/latest)
- Install it
- Into your root directory (recommended)
```shell
$ sudo tar -xvzf docker4ssh-.tar.gz -C /
```
- To the same directory
```shell
$ sudo tar -xvzf docker4ssh-.tar.gz
```
- Building from source
Before start installing, make sure you have to following things ready:
- [Go](https://go.dev/) installed
- [Rust](https://www.rust-lang.org/) installed
- [Make](https://www.gnu.org/software/make/) installed - optional, but highly recommended since we use `make` in the further instructions
To install docker4ssh, just execute the following commands
```shell
$ git clone https://github.com/ByteDream/docker4ssh
$ cd docker4ssh
$ make install
```
- Install it from the [AUR](https://aur.archlinux.org/packages/docker4ssh/) (if you're using arch or an arch based distro)
```shell
$ yay -S docker4ssh
```
## π Usage
To start the docker4ssh server, simply type
```shell
$ docker4ssh start
```
The default port for the ssh server is 2222, if you want to change it take a look at the [config file](https://github.com/ByteDream/docker4ssh/wiki/docker4ssh.conf).
Dynamic profile generation is enabled by default, so you can start right away.
Type the following to generate a new ubuntu container and connect to it:
```shell
$ ssh -p 2222 ubuntu:latest@127.0.0.1
```
You will get a password prompt then where you can type in anything since by default any password is correct.
If you typed in a password, the docker container gets created and the ssh connection is "redirected" to the containers' tty:
```shell
ubuntu:latest@127.0.0.1's password:
ββββContainerβββββββββββββββββ
β Container ID: e0f3d48217da β
β Network Mode: Host β
β Configurable: true β
β Run Level: User β
β Exit After: β
β Keep On Exit: false β
βββββββββββββββInformationββββ
root@e0f3d48217da:/#
```
For further information, visit the [wiki](https://github.com/ByteDream/docker4ssh/wiki).
## β License
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) - see the [LICENSE](LICENSE) file for more details.