A Dockerfile for an alpine ssh server
To the run the Dockerfile you'll need to put your public key under the name id_rsa.pub
in the same location as the Dockerfile (the name can be changed inside the Dockerfile). You'll additionally need to follow the following steps:
-
Start Docker
-
Open a terminal and navigate to the Dockerfile
-
Build an image with the following command:
docker build -t alpinessh .
-
Run the container with the following command:
docker run -d --name ssh -p 5554:22 alpinessh
- Note: This will map the container's ssh server to the port 5554, you can change that by changing the port above.
You should now be able to access your Docker container by ssh on your 5554 port.