Skip to content

Conversation

quirino95
Copy link
Contributor

When a ssh/sftp connection is configured, the first run (both backup or jobrunner) fails because there is no file /root/.ssh/known_hosts, which has to be created manually.
This fix in Dockerfile creates .ssh folder and known_hosts file, in order to make the first run right and avoid this kind of error.

@pedrobaeza
Copy link
Member

AFAIK, this is done in the scaffolding. Can you confirm, @josep-tecnativa ?

@aleuffre
Copy link

aleuffre commented Aug 12, 2025

I can confirm that the file is not present

Output of

docker container run --rm ghcr.io/tecnativa/docker-duplicity-postgres:edge sh "ls -al /root/.ssh"

is as follows:

fetch https://dl-cdn.alpinelinux.org/alpine/v3.22/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.22/community/x86_64/APKINDEX.tar.gz
(1/1) Installing postgresql16-client (16.9-r0)
Executing postgresql-common-1.2-r1.trigger
* Setting postgresql16 as the default version
*
* You are using 'postgresql16'. It's recommended to upgrade to the latest
* major version provided by package 'postgresql17'.
* Use command 'pg_versions' to switch between versions.
*
OK: 50 MiB in 95 packages
psql (PostgreSQL) 16.9
pg_dump (PostgreSQL) 16.9
sh: can't open 'ls -al /root/.ssh': No such file or directory

That said, I'm not sure if this would work the moment you use a volume to preserve /root as recommended in Doodba https://github.com/Tecnativa/doodba-copier-template/blob/main/common.yaml.jinja#L113

@quirino95 Can you check? Alternatively, the commands you added could go in the entrypoint instead.

@quirino95
Copy link
Contributor Author

Updated code, moved command in entrypoint.

@josep-tecnativa
Copy link
Contributor

TBH, we’ve never needed that, but if you’ve been running into issues due to a missing .ssh/known_hosts, I’m fine with creating it in the entrypoint. Just make sure the folder has the required permissions.

@quirino95
Copy link
Contributor Author

Hi @josep-tecnativa , I've made the permissions explicit to be sure, both on .ssh folder and known_hosts file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants