Class DockerUtils

java.lang.Object
com.amazonaws.xray.utils.DockerUtils

public class DockerUtils extends Object
Utility class to get metadata for dockerized containers
  • Constructor Details

    • DockerUtils

      public DockerUtils()
    • DockerUtils

      public DockerUtils(URL cgroupLocation)
  • Method Details

    • getContainerId

      public @Nullable String getContainerId() throws IOException
      Reads the docker-generated cgroup file that lists the full (untruncated) docker container ID at the end of each line. This method takes advantage of that fact by just reading the 64-character ID from the end of the first line.
      Returns:
      the untruncated Docker container ID, or null if it can't be read
      Throws:
      IOException - if the file cannot be read