public Builder setEnvironment(@Nullable Map<String, String> environmentMap) {
      if (environmentMap == null) {
        this.environmentMap = null;
      } else {
        Preconditions.checkArgument(
            !Iterables.any(environmentMap.keySet(), Objects::isNull),
            "environment map contains null keys");
        String nullValuedKeys =
            environmentMap.entrySet().stream()
                .filter(entry -> entry.getValue() == null)
                .map(Map.Entry::getKey)
                .collect(Collectors.joining(", "));
        Preconditions.checkArgument(
            nullValuedKeys.isEmpty(),
            "environment map contains null values for key(s): " + nullValuedKeys);
        this.environmentMap = new HashMap<>(environmentMap);
      }
      return this;
    }
Sets the container's environment variables, mapping variable name to value.

@param environmentMap the map
@return this
jib-core/src/main/java/com/google/cloud/tools/jib/configuration/ContainerConfiguration.java