我需要在Docker容器中配置SSH服务以进行远程调试 我阅读了Docker化SSH服务并获取dockerfile。但是,由于各种原因,我需要输入容器以使用bash命令行配置SSH。
有4个我不知道如何转换为bash的dockerfile命令 命令,请帮助我。
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
EXPOSE 22 7777
CMD ["/usr/sbin/sshd", "-D"]
答案 0 :(得分:1)
您可以尝试以下方法:
# set Environmentvariable
export NOTVISIBLE="in users profile"
# append 'export VISIBLE=now' to /etc/profile
echo "export VISIBLE=now" >> /etc/profile
# start ssh daemon in foreground
/usr/sbin/sshd -D
EXPOSE从容器派生端口22和7777,并且不能使用bash脚本进行设置。创建容器时必须完成此操作。