Start sshd automatically with docker container

前端 未结 7 1206
抹茶落季
抹茶落季 2020-12-10 10:33

Given:

  • container based on ubuntu:13.10
  • installed ssh (via apt-get install ssh)

Problem: each when I start container I hav

7条回答
  •  情歌与酒
    2020-12-10 11:00

    This is quite an old question, but for the sake of others finding it, I think the correct way to do it would follow docker's instructions to dockerizing the ssh service.

    And in correlation to the specific question, the following lines added at the end of the dockerfile will achieve what you were looking for:

    EXPOSE 22
    CMD ["/usr/sbin/sshd", "-D"]
    

    Dockerize a SSHD service

提交回复
热议问题