Run the TRIGGERcmd linux agent in a Docker container
-
Docker provides a quick and easy way to package and run Linux software. This also works on Windows if you run Docker on Windows.
Here's how to build and run a Docker container that runs the TRIGGERcmd agent:
Create a text file called Dockerfile with these contents:
FROM ubuntu ENV DEBIAN_FRONTEND=noninteractive RUN apt-get -y update && apt-get -y upgrade RUN apt install -y nodejs npm wget RUN wget https://s3.amazonaws.com/triggercmdagents/triggercmdagent_1.0.1_amd64.deb RUN apt install -y ./triggercmdagent_1.0.1_amd64.deb CMD node /usr/lib/triggercmdagent/resources/app/src/agent.js --console
To build the container image, cd to the directory where you put the Dockerfile file, then run this command:
docker build . --tag=triggercmdagent
To see your new Docker image in your local Docker cache, run this command:
docker images
To run your new image on Linux and use /tmp as your TRIGGERcmd data folder, run:
docker run -it -v /tmp:/root/.TRIGGERcmdData triggercmdagent
To run your new image on Windows and use c:\mydir as your TRIGGERcmd data folder, run:
docker run -it -v c:\mydir:/root/.TRIGGERcmdData triggercmdagent
When you run it, you'll see it prompt for your token (from the Instructions page):
Run installdaemon.sh to install the triggercmdagent daemon so it runs during boot Daemon install: false No token exists. Login to request one. prompt: token:
EDIT 3/28/21: I improved the docker container and published the code here:
https://github.com/rvmey/docker-triggercmdagent -