This project demonstrates how to create and configure two Docker containers: one as an SSH server and the other as an SSH client. The containers are managed using Docker Compose.
- SSH Server: A container running an OpenSSH server configured for root login.
- SSH Client: A container designed to interact with the SSH server.
- Built from a common Dockerfile.
- Utilizes
docker-compose
for simplified management.
- Docker and Docker Compose installed on your machine.
-
Clone this repository:
git clone https://github.com/ahmedmaged6/openssh-containers.git cd openssh-containers
-
Build and start the containers:
docker-compose up -d --build
-
Access the SSH client container:
docker exec -it openssh-containers-ssh-client-1 bash
-
From the SSH client, connect to the SSH server:
ssh root@openssh-containers-ssh-server-1
The default password is
0
.
Stop and remove the containers:
docker-compose down
- The
ssh-server
service is configured to always restart. - The
ssh-client
service runs indefinitely withsleep infinity
.