Closed markusweigelt closed 8 months ago
Indeed! That is despite Dockerfile(5)'s documentation for CMD
stating
The CMD instruction sets the command to be executed when running a container from an image.
Obviously, in fact CMD
is executed when starting a container, which is subtly different.
So what we have to do is check (in all these cases) if the file has already been written to last time.
Perhaps here, simply checking for the existence of the file would suffice.
perhaps here, simply checking for the existence of the file would suffice.
In the case of /.ssh/rc
– yes, but for authorized_keys and passwd – no.
Ok, but we can use /.ssh/rc
as base condition to check if start-sshd.sh
has already run. So, I think explicitly checking the other files is not necessary.
Oh, right!
When the container is restarted without being removed, the start-sshd.sh script runs again.
The problem is that all configurations are appended to the configuration files, such as /.ssh/authorized_keys, /.ssh/rc, etc.