Enable SSH access to an EnterMedia Docker Instance
In order to enable ssh access to EnterMedia Docker instance in a Linux Server you need to follow next steeps:
1. Enable ssh user script. We provide a script that needs to be executed once the EnterMedia instance is build. EnterMedia initialization sequence searches for Bash scripts to run in the /media/instance/services path. Create a script or edit the startup.sh to call the internal commands:
This 2 scripts will create a user and enables the SSH access with a Key. Second script will enable SSHD on instance starts.
2. Restart EnterMedia Instance
You will have a puclic key at: /media/instance/services/client/.ssh/client.pk that you can use to login to the instace.
3. Enable external traffic to connect to the Instance. In the firewall.sh script we provide for initial installations you will need to add a Pre-routing iptables directive in order to route the trafic to the EnterMedia Instance 22 port. Right before the iptables saving line add the rule:
#Enable route traffic from port 2290 to instance's port 22 iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2299 -j DNAT --to-destination 172.18.0.99:22
Customize the external port (2299) and the local Docker IP Address (172.18.0.99) assigned to your container then save and run the firewall.sh script as root user.
You should be able now to connect to the container from external place using:
ssh -i /path_to_ssh_key/client.key firstname.lastname@example.org -p 2290