accetto/ubuntu-vnc-xfce-g3

Start SSH Server

Closed this issue · 4 comments

I want to start ssh service just after docker startup

in my Dockerfile
FROM accetto/ubuntu-vnc-xfce-g3:24.04
....
RUN sed -i '234i\sudo /etc/init.d/ssh restart' /dockerstartup/startup.sh
RUN echo "headless ALL = (ALL) NOPASSWD:/etc/init.d/ssh" > /etc/sudoers.d/headless_sshd
....

no effect at all

what should i do, can you please help me?

Hello,

an SSH server is not included in this image. However, you can install it yourself in a running container:

sudo apt-get update
sudo apt-get install openssh-server

If you need it permanently, you can customize the Dockerfile and to install and configure it there. Then you can build your own images using the Dockerfile.

Regards,
accetto

sorry for incomplete code

I installed openssh-server in my dockerfile and tried to run it in /dockerstartup/startup.sh just as

in my Dockerfile
FROM accetto/ubuntu-vnc-xfce-g3:24.04
....
RUN apt update && apt install openssh-server -y

RUN sed -i '234i\sudo /etc/init.d/ssh restart' /dockerstartup/startup.sh
RUN echo "headless ALL = (ALL) NOPASSWD:/etc/init.d/ssh" > /etc/sudoers.d/headless_sshd
....

It was ok to run it manually but no effect from startup.sh

latest update

insert "sudo /etc/init.d/ssh restart" to the very beginning in /dockerstartup/startup.sh can resolve my question

thanks a lot

Close