Sign inSign up

expresssocket/socketxp

By expresssocket

•Updated over 4 years ago

Image
0

1.3K

expresssocket/socketxp repository overview

⁠How to run SocketXP Docker Container

Follow the below steps to run the SocketXP docker container.

⁠Step #1

Create a config.json file in a folder in the host machine as follows:

$ mkdir -p /var/lib/socketxp
$cat /var/lib/socketxp/config.json
{ 
   "authtoken": "your-authtoken-here",
   "tunnels" : [
   { 
      "destination": "tcp://127.0.0.1:22" 
   }
   ]
}

Please make sure that your SSH server is running on your host machine and listening on port 22. Otherwise, SocketXP agent may not be able to connect to your SSH server.

Note: If you don't want to have the authtoken in the config.json file for security reasons, then generate a device.key file (usually found at /var/lib/socketxp folder) using the socketxp login <authtoken> command on any machine. Copy the device.key file to the /var/lib/socketxp folder in the host machine before starting the docker container.

⁠Step #2:

Run the docker container in the host machine's network namespace, so that you could connect to services running in the host machine from remote. Also, mount the host directory inside the container at /var/lib/socketxp. This is required to expose the config.json file to docker container and also to provide a persistent storage for the device.key file and logs.

$ docker run --name socketxp -d --net=host -v /var/lib/socketxp:/var/lib/socketxp expresssocket/socketxp

⁠Step #3

Check the docker logs.

$ docker logs socketxp

Check if the socketxp login is successful and the TCP tunnel to the local SSH server is up. Now you should be able to SSH from the portal to the host machine.

⁠Dockerfile:

Here is the dockerfile used to build the SocketXP docker container. Feel free to make changes to build an image to suit your needs and requirements. You can download the SocketXP binary file from https://www.socketxp.com/download⁠

$ cat Dockerfile 
FROM centos:latest
RUN mkdir -p /usr/local/bin/
COPY ./socketxp /usr/local/bin/
RUN chmod +x /usr/local/bin/socketxp
ENTRYPOINT ["sh", "-c", "nohup /usr/local/bin/socketxp --config /var/lib/socketxp/config.json"]

Tag summary

Content type

Image

Digest

Size

92.4 MB

Last updated

over 4 years ago

docker pull expresssocket/socketxp