idea / Dockerfile-nginx-ssh
oulh's picture
test1
a57b9ea
raw
history blame
No virus
1.08 kB
FROM ubuntu:20.04
USER root
EXPOSE 80 8080
# set password
RUN whoami && echo "root:zxcvbnm" | chpasswd
# init
RUN apt update
RUN ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone && \
# yes | unminimize && \
apt install -y openssh-server openssh-client bash-completion git curl vim
# nginx
RUN \
apt install -y curl gnupg2 ca-certificates lsb-release ubuntu-keyring && \
curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor \
| tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null && \
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" \
| tee /etc/apt/sources.list.d/nginx.list && \
apt update && apt install -y nginx
# COPY ./nginx.conf /etc/nginx/
# SSH
RUN cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak && \
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
# mkdir -p /run/sshd
# echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
CMD chown root:root / && sshd -T && service ssh start && service nginx start