Sign inSign up

haifengat/centos

By haifengat

•Updated about 6 years ago

Image
0

141

haifengat/centos repository overview

⁠说明

带sshd版本 centos8.2有中文乱码问题未解决,请使用8.1 在此基础上的docker需要在启动的脚本中加入 /usr/sbin/sshd -D &

⁠Dockerfile

FROM centos:centos8.1.1911
### root:123456

### author label
LABEL maintainer="HaiFeng"

### 解决ssh连接后丢失 docker run ... -e 设置的环境变量的问题
RUN echo "export \$(cat /proc/1/environ |tr '\0' '\n' | xargs)" >> ~/.bashrc

### 密码 # 配置 ll #修改时区
RUN echo "root:123456" | chpasswd \\
&& echo "alias ll='ls $LS_OPTIONS -lh --color=auto'" >> ~/.bashrc \
&& rm -rf /etc/localtime && ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

### 换源  升级
RUN mv /etc/yum.repos.d /etc/yum.repos.d.backup \
&& mkdir /etc/yum.repos.d \
&& curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo \
&& sed -i 's#gpgcheck=.*#gpkcheck=0#g' /etc/yum.repos.d/CentOS-Base.repo \
&& sed -i 's#enabled=.*#enabled=1#g' /etc/yum.repos.d/CentOS-Base.repo

RUN yum clean all && yum makecache && yum -y update --refresh

### 安装git  sshd服务   中文环境
RUN yum install git openssh-server langpacks-zh_CN.noarch -y
RUN yum clean all

ENV LANG zh_CN.UTF-8
ENV LC_ALL zh_CN.UTF-8

### port
EXPOSE 22

### 启动sshd
RUN ssh-keygen -q -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key -N '' \
&& ssh-keygen -q -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N '' \
&& ssh-keygen -t dsa -f /etc/ssh/ssh_host_ed25519_key -N ''
ENTRYPOINT ["/usr/sbin/sshd", "-D"]

Tag summary

Content type

Image

Digest

Size

207.4 MB

Last updated

about 6 years ago

docker pull haifengat/centos:8.2