accetto / ubuntu-vnc-xfce-g3

Headless Ubuntu/Xfce containers with VNC/noVNC (G3v6).
MIT License
223 stars 63 forks source link

Start SSH Server #65

Closed chenzilin closed 2 months ago

chenzilin commented 2 months ago

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?

accetto commented 2 months ago

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

chenzilin commented 2 months ago

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

chenzilin commented 2 months ago

latest update

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

thanks a lot

chenzilin commented 2 months ago

Close