Updating Docker removes private SSH key


Recommended Posts

I'm trying to setup passwordless ssh access inside a docker container to another one of my servers in order to send commands through ssh. I have it working but whenever I update the docker container it rebuilds it and I lose the SSH key that is under /root/.ssh/id_rsa

 

Is there anyway to store the private key id_rsa in one of the config directory of the docker container and copy that into /root/.ssh/ upon build time so every time it updates I won't lose the key? Thanks! 

Link to comment

I'm trying to do this for the home-assistant container. Also is there any way to allow docker containers to see deployed ip addresses of other docker containers? For example I'm trying to access another docker container pihole through the command 

curl -X GET 'http://192.168.1.xx/admin/api.php?status' in order to get some information but I just keep getting the error

curl: (7) Failed to connect to 192.168.1.xx port 80: No route to host

 

Is it because home assistant docker is set to host but the pihole has a changed ip address so the network type is br0? When I type the same command through another computer I see the results fine it's just within the docker container it's being restricted access to not being able to see pihole

Link to comment

A container on br0 can't communicate with one that has a dedicated ip.  Limitation of docker networking.

 

As for the SSH key add another path to the container

 

/mnt/cache/appdata/home-assistant/ssh/id_rsa

and map it to 

/.ssh/id_rsa

 

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.