SSH in Your Container
Edgegap does not recommend having SSH service accessible in your production deployments.
Modifying your Dockerfile
We will build the docker container using a different Docker Dockerfile
in this version.
We will need to install the OpenSSH service and enable it Create a User and a password to connect to your server.
In a container running on Alpine, merge the following:
RUN apk --update add --no-cache openssh bash
RUN sed -i s/#PermitRootLogin.*/PermitRootLogin\ yes/ /etc/ssh/sshd_config
RUN echo "tester:$ecureP@ss" | chpasswd
EXPOSE 22
In a container running on Ubuntu, add the following:
RUN apt-get update
RUN apt-get install openssh-server sudo -y
RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1000
RUN echo 'tester:$ecureP@ss' | chpasswd
EXPOSE 22
In your entrypoint, you will need to add the following command:
service ssh start
We suggest testing the deployment locally, using the docker run command to test the server start.
Once tested, you can push your new version on the container repository.
On Edgegap
We suggest having a version called -dev
or something that would make sense in your service. By doing so, you will have the option to do some tests and log into your container easily using the Edgegap infrastructure.
Create a new version of your app, adding the
Expose TCP Port 22
Create a deployment using the new version you just created
Once you have the service running (Ready), look in your deployment information. You will see the external port mapping of port 22.
You can use Putty and connect using the FQDN of the deployment or Ip & the port mapping used
The username and password that you configured.
Last updated
Was this helpful?