Start the pod with a custom command after the pod finishes startup

How can add I command that the pod will execute after it has finished starting up? I tried using
bash -c 'apt update;DEBIAN_FRONTEND=noninteractive apt-get install openssh-server -y;mkdir -p ~/.ssh;cd $_;chmod 700 ~/.ssh;echo "$PUBLIC_KEY" >> authorized_keys;chmod 700 authorized_keys;service ssh start;sleep infinity'

And replaced sleep infinity with apt install nano -y
bash -c 'apt update;DEBIAN_FRONTEND=noninteractive apt-get install openssh-server -y;mkdir -p ~/.ssh;cd $_;chmod 700 ~/.ssh;echo "$PUBLIC_KEY" >> authorized_keys;chmod 700 authorized_keys;service ssh start;apt install nano -y'

The container starts but I am unable to access it using ssh or the web terminal.
Solution
You can try the other way around:
apt update && apt -y install nano && /start.sh
Was this page helpful?