Public Repository

Last pushed: 2 years ago
Short Description
Short description is empty for this repo.
Full Description

docker run -it centos:7 bash

From inside the container update it

yum -y update

Install necessary packages like
openssh-clients, openssh-server, net-tools, wget, which, tcpdump, ntp

Use below command to figure out which package has to be installed
yum whatprovides <service_name>

After installing open-ssh server
results in an error wrt keys
Following needs to be performed:

ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
ssh-keygen -A -f /etc/ssh/ssh_host_ed25519_key

This will generate the necessary keys for ssh server
And then run as:
netstat -an | grep :22

Start ntpd

Commit as an image and push to dockerhub:
Find the container id
docker commit f1bd71176dbf swinburn11/centos7base:1

Create 2 container using the above image and test ssh between them

First Create a test network
docker network create test

docker run -ti -h alpha --net=test --name alpha swinburn11/centos7base:1 bash -c "/usr/sbin/sshd; /usr/sbin/ntpd ;bash"
docker run -ti -h beta --net=test --name beta swinburn11/centos7base:1 bash -c "/usr/sbin/sshd; /usr/sbin/ntpd ;bash"

You should be able to ping and ssh between the containers without a password

Stop and remove all container:

docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)

Docker Pull Command