Run the container :
$ docker run -d -P -e SSH_KEY='YOUR PUB KEY' ayoubensalem/aymanGet the container ip :
$ docker inspect CONTIAINER_ID | jq -r ".[0].NetworkSettings.Networks.bridge.IPAddress"Try to ssh into it :
$ ssh ayman@CONTAINER_IPRUN THIS COMMAND :
$ ssh-keygenWhen done, copy the PUB KEY generated and in the host type this command:
$ echo "PUB_KEY" >> authorized_keysMake sur that the authorized_keys has 644.
And now, you could be able to ssh from the container to the host.