创建Dockerfile
1 2 3 4 5 6 7 8 9 10 11 12 13
| FROM ubuntu:latest
RUN apt update && apt install vim openssh-server sudo -y
RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1000 ubuntu
RUN echo 'ubuntu:ubuntu' | chpasswd
RUN service ssh start
EXPOSE 22
CMD ["/usr/sbin/sshd","-D"]
|
构建镜像
1
| docker build -t fify/ubuntu-ssh .
|
启动镜像
1
| docker run -d --name=doris-be1 --hostname=doris-be1 -p 2122:22 fify/ubuntu-with-openssh
|
转载请注明出处:构建含有OpenSSH服务器的Ubuntu基础镜像原文地址:https://www.xiaotanzhu.com/docker/2022-05-07-docker-ubuntu-with-openssh.html