Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Docker generates an image with SSH function

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Cat Dockerfile

FROM centos:7.5.1804

MAINTAINER ljx

# install ssh

RUN yum install-y openssh-server

RUN sed-I 's/UsePAM yes/UsePAM no/g' / etc/ssh/sshd_config

RUN yum install-y openssh-clients

# configure root name

RUN echo "root:Lahmy1c!" | chpasswd

RUN echo "root ALL= (ALL) ALL" > > / etc/sudoers

# generate ssh key

RUN ssh-keygen-t dsa-f / etc/ssh/ssh_host_dsa_key

RUN ssh-keygen-t rsa-f / etc/ssh/ssh_host_rsa_key

# configure sshd service

RUN mkdir / var/run/sshd

EXPOSE 22

ENTRYPOINT ["/ usr/sbin/sshd", "- D"]

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report