| author | Faisal Qureshi |
|---|---|
| faisal.qureshi@ontariotechu.ca |
The Dockerfile shows how to run an SSH server within a container.
$ docker build -t ssh-image .$ docker run -d -P --name ssh-container ssh-imageIf container already exists (or running), use docker rm to remove it as follows
$ docker rm --force ssh-containerUse the following to see port mapping
$ docker port ssh-containerNext check the IP address of this container
$ docker inspect ssh-containerThis returns a JSON string. Look for IPAddress under Network setting.
Now ssh into the container
$ ssh dockeruser@localhost -p <PORT>PORT can be found using docker port command as shown above.