Possible to expose ports on drone containers when using drone exec

Is it possible to expose ports on the drone container that is being executed? I want to be able to attach a debugger to an image to troubleshoot problems.

Although there might a way to do exactly what you want, it’s way easier to manually run the image. Remember that Drone only starts containers with a specific environment. It’s fairly easy to recreate such an environment yourself.

For example (using Node.js):

docker run --rm \
  -p 1234:1234 \         # Replace with your debugger port
  -v $(pwd):$(pwd) \     # Mount your project directory as a volume
  -w $(pwd) \            # Set your working directory
  node:latest \          # Replace this with the image you're using to test
  node --inspect test.js # Replace this with some command that starts the tests

If you require more control (timing, etc.), you can even run it interactively:

docker run --rm \
  -it \                  # Run the container interactively
  -p 1234:1234 \         # Replace with your debugger port
  -v $(pwd):$(pwd) \     # Mount your project directory as a volume
  -w $(pwd) \            # Set your working directory
  node:latest \          # Replace this with the image you're using to test
  /bin/sh                # Or bash if it's available

Then just start the tests (node --inspect test.js) in the terminal session that Docker created for you whenever you’re ready.

If you require some environment variables, you can set them using the -e flag.

@mjwwit solution is not enough, I’m looking for a way to debug my Node server while running e2e tests (which depend on external services like Postgres) with drone exec and exposing some additional ports might be the way to go.

¿Is there a way to archive this @bradrydzewski?

Drone does not expose ports, so you would have to docker exec directly into a running container to troubleshoot.