Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-70288

docker.inside(..) does not work with busybox top.

XMLWordPrintable

      We are building docker images based on the Google distroless java images where the only non-JDK binaries are busybox symlinks.

      According to https://github.com/jenkinsci/docker-workflow-plugin/blob/master/src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java#L153 

       

      LaunchResult result = launch(launchEnv, false, "top", containerId, "-eo", "pid,comm");

      the way to get a list of processes currently running is to parse the output of "top -eo pid,comm".   

      The busybox `top` does not support this so it halts immediately and the container goes away with an IOException.

       

      ~ $ top -eo pid,comm
      top: unrecognized option: e
      BusyBox v1.34.1 (2022-04-13 00:26:55 UTC) multi-call binary.Usage: top [-bmH] [-n COUNT] [-d SECONDS]Show a view of process activity in real time.
      Read the status of all processes from /proc each SECONDS
      and show a screenful of them.
      Keys:
              N/M/P/T: show CPU usage, sort by pid/mem/cpu/time
              S: show memory
              R: reverse sort
              H: toggle threads, 1: toggle SMP
              Q,^C: exit
      Options:
              -b      Batch mode
              -n N    Exit after N iterations
              -d SEC  Delay between updates
              -m      Same as 's' key
              -H      Show threads

            Unassigned Unassigned
            ravn ravn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: