When running the Sprkl CLI with Docker (either
docker run), Sprkl will attach a volume and configure the environment so that the node runtime inside the docker container will be correctly instrumented.
As usual, Sprkl analyzes the code in the repository under the current working directory. The instrumentation applied is according to the code on your local machine. So once running Sprkl with a docker command, make sure the docker images are built up to date.
You can run your docker commands with sprkl like so:
# Docker image with default entrypoint
sprkl -- docker run my_image
# Docker image with non-default entrypoint:
sprkl -- docker run my_image node index.js
# Using docker cli arguments
sprkl -- docker run --rm -it my_image node index.js
Sprkl CLI supports the full docker command syntax; you can use it as you would any other docker command.
Sprkl can instrument docker-compose applications by updating the
# Docker compose
sprkl -- docker compose up
Sprkl transforms the compose file to add environment to the containers and attach sprkl to them with a volume.
If you wish to get the changed compose.yml file, run the following:
sprkl -- docker-compose-transform