---
title: "Find EOL Dockerfile Base Images with SQL"
description: "Node 18 reached end-of-life. Find every Dockerfile using Node 18 base images across your organization with a single SQL query - no cloning repos required."
url: https://www.joekarlsson.com/blog/query-dockerfiles-for-eol-base-images-with-sql/
---

Jan 4, 2026 (Updated Nov 12, 2026 ) | 3 min read | [Cloud](https://www.joekarlsson.com/blog/category/cloud/) | [Written for CloudQuery](https://www.joekarlsson.com/blog/written-for/cloudquery/)

# Query Your Dockerfiles with SQL: Find EOL Node 18 Images Across All repos

**Blog** Node 18 reached end-of-life. Find every Dockerfile using Node 18 base images across your organization with a single SQL query - no cloning repos required.

**Corrections**

-   **Nov 12, 2026:** The Git source config used syntax the plugin doesn’t take. It’s `table_options.git_files` with `glob`.

This post was originally published on CloudQuery blog.

**TL;DR** The Git Source Integration syncs Dockerfile content into your database. Query FROM statements across all repos with SQL to find EOL base images like Node 18, Python 2.7, or Ubuntu 18.04 - no cloning required.

On this page

1.  [Configuration](https://www.joekarlsson.com/blog/query-dockerfiles-for-eol-base-images-with-sql/#configuration)
2.  [Query EOL Docker Base Images](https://www.joekarlsson.com/blog/query-dockerfiles-for-eol-base-images-with-sql/#query-eol-docker-base-images)
3.  [Results](https://www.joekarlsson.com/blog/query-dockerfiles-for-eol-base-images-with-sql/#results)
4.  [Beyond Node 18](https://www.joekarlsson.com/blog/query-dockerfiles-for-eol-base-images-with-sql/#beyond-node-18)
5.  [Complete Example](https://www.joekarlsson.com/blog/query-dockerfiles-for-eol-base-images-with-sql/#complete-example)
6.  [Get Started](https://www.joekarlsson.com/blog/query-dockerfiles-for-eol-base-images-with-sql/#get-started)
7.  [FAQ](https://www.joekarlsson.com/blog/query-dockerfiles-for-eol-base-images-with-sql/#faq)

[Node 18 reached end-of-life in April 2025](https://github.com/nodejs/release#release-schedule). You need to find which Dockerfiles across your organization still reference `node:18` base images. The manual approach: clone every repo, grep for Dockerfiles, parse the FROM lines, compile results, email teams, track remediation. Multiply that across hundreds of repos and multiple EOL versions.

**[1](https://www.joekarlsson.com/blog/query-dockerfiles-for-eol-base-images-with-sql/#mn-w-1)**

[Find EOL Docker Images, Missing Licenses, and Stale CODEOWNERS Across Thousands of repos with SQL](https://www.joekarlsson.com/blog/introducing-the-git-source-plugin/): The launch post for the Git source integration, with the CODEOWNERS and package.json queries too.

The [Git Source Integration](https://www.cloudquery.io/hub/plugins/source/cloudquery/git) syncs Dockerfile content into your data warehouse [1](https://www.joekarlsson.com/blog/query-dockerfiles-for-eol-base-images-with-sql/#mn-1). Query EOL base images across all repos with SQL.

## Configuration

Configure the Git source integration to sync Dockerfiles:

```yaml
tables: ['git_files', 'git_repositories']
spec:
  table_options:
    git_files:
      - glob: '*Dockerfile*'
        include_content: true
```

This syncs all files matching the Dockerfile pattern from your repositories into the `git_files` table.

## Query EOL Docker Base Images

Find all Dockerfiles using Node 18:

```sql
WITH Dockerfiles_parsed AS (
  SELECT repository_url, path, name,
         regexp_split_to_table(convert_from(content, 'UTF8'), E'\n') AS line
  FROM git_files
  WHERE name = 'Dockerfile'
),
images AS (
  SELECT repository_url, path, regexp_replace(line, '^FROM\s+', '') AS image
  FROM Dockerfiles_parsed
  WHERE line ~ '^FROM\s+'
)
SELECT * FROM images WHERE image LIKE 'node:18%'
```

The query:

1.  Parses Dockerfile content into individual lines
2.  Extracts FROM statements using regex
3.  Filters for Node 18 base images

## Results

The query returns:

-   `repository_url` - Repository containing the Dockerfile
-   `path` - Path to the Dockerfile
-   `image` - Full base image reference (e.g., `node:18-alpine`, `node:18.16.0`)

**[2](https://www.joekarlsson.com/blog/query-dockerfiles-for-eol-base-images-with-sql/#mn-w-2)**

[Audit CODEOWNERS Against Okta to Find Orphaned Code Ownership with SQL](https://www.joekarlsson.com/blog/audit-codeowners-against-okta-with-sql/): Owners go stale too. I joined CODEOWNERS files with identity provider data to find entries for people who already left.

Cross-reference results with your GitHub data to identify repo owners and create tracking issues [2](https://www.joekarlsson.com/blog/query-dockerfiles-for-eol-base-images-with-sql/#mn-2).

## Beyond Node 18

**[3](https://www.joekarlsson.com/blog/query-dockerfiles-for-eol-base-images-with-sql/#mn-w-3)** We have decided that January 1, 2020, was the day that we sunset Python 2.[Python Software Foundation](https://www.python.org/doc/sunset-python-2/)

Modify the query to find other EOL images [3](https://www.joekarlsson.com/blog/query-dockerfiles-for-eol-base-images-with-sql/#mn-3):

**[3](https://www.joekarlsson.com/blog/query-dockerfiles-for-eol-base-images-with-sql/#mn-w-3)** We have decided that January 1, 2020, was the day that we sunset Python 2.[Python Software Foundation](https://www.python.org/doc/sunset-python-2/)

**Python 2.7:**

```sql
WHERE image LIKE 'python:2.7%'
```

**Ubuntu 18.04:**

```sql
WHERE image LIKE 'ubuntu:18.04%'
```

**Multiple EOL versions:**

```sql
WHERE image LIKE 'node:18%' OR image LIKE 'node:16%' OR image LIKE 'python:2.7%'
```

## Complete Example

Join with GitHub repository data to identify owners:

```sql
WITH Dockerfiles_parsed AS (
  SELECT repository_url, path, name,
         regexp_split_to_table(convert_from(content, 'UTF8'), E'\n') AS line
  FROM git_files
  WHERE name = 'Dockerfile'
),
images AS (
  SELECT repository_url, path, regexp_replace(line, '^FROM\s+', '') AS image
  FROM Dockerfiles_parsed
  WHERE line ~ '^FROM\s+'
),
eol_images AS (
  SELECT * FROM images WHERE image LIKE 'node:18%'
)
SELECT
  ei.repository_url,
  ei.path,
  ei.image,
  gr.full_name,
  gr.owner
FROM eol_images ei
JOIN git_repositories gr ON gr.url = ei.repository_url
```

This combines file content analysis with repository metadata for actionable results.

## Get Started

The Git Source Integration is available on [CloudQuery Hub](https://www.cloudquery.io/hub/plugins/source/cloudquery/git). See the [tables documentation](https://www.cloudquery.io/hub/plugins/source/cloudquery/git/latest/tables) for the full `git_files`, `git_repositories`, and `git_commits` schema. [Download the CloudQuery CLI](https://www.cloudquery.io/download) to start querying Dockerfiles.

**Related:**

-   [Git Source Integration overview](https://www.cloudquery.io/blog/introducing-the-git-source-plugin)
-   [Find repos missing LICENSE files](https://www.cloudquery.io/blog/find-repos-missing-license-files-with-sql)
-   [Track React dependencies](https://www.cloudquery.io/blog/track-react-dependencies-across-repos-with-sql)

## FAQ

**How does the Git source integration access Dockerfiles?**

The integration fetches file content directly via the Git provider’s API. There’s no local clone, which means faster syncs and no disk space requirements for repository storage.

**Can I query other Dockerfile patterns beyond FROM statements?**

Yes. The integration syncs raw Dockerfile content. Query for EXPOSE ports, ENV variables, COPY commands, or any other Dockerfile instruction using PostgreSQL string functions and regex.

**Does this work for multi-stage Dockerfiles?**

Yes. Multi-stage Dockerfiles have multiple FROM statements. The query extracts all FROM lines, showing each base image used in the build stages.

**How often should I run this query?**

Depends on your release cycle. Running weekly catches new Dockerfiles with EOL images before they reach production. Combine with CloudQuery’s incremental sync to update only changed files.

**What if Dockerfiles use variables for base images?**

Variables like `ARG BASE_IMAGE` won’t appear in the FROM statement directly. You’ll need to parse ARG statements separately and correlate with FROM statements, or query your CI/CD system for actual resolved image names.

**Can I track when EOL images were introduced?**

The `git_files` table includes commit metadata. Join with commit history to identify when specific Dockerfiles were last modified or when Node 18 references were added.

**Does this work with Dockerfiles in subdirectories?**

Yes. The glob pattern `*Dockerfile*` matches Dockerfiles at any directory depth, including `Dockerfile.prod`, `Dockerfile.dev`, and files in subdirectories like `docker/Dockerfile`.

**How do I sync Dockerfiles from private repositories?**

Configure the Git source integration with credentials for your Git provider (GitHub token, GitLab token, etc.). The integration authenticates and syncs content from private repos you have access to.

## Works on My Machine

Get the next post by email. My newsletter covers homelab builds, AI tools and open source, and it goes out when I have something to say.

It’s free, and you can unsubscribe anytime. You’ll get an email to confirm first.

![Joe Karlsson at his desk, chin on hand, with a microphone in front of him](https://www.joekarlsson.com/images/about/collage/studio.webp)

Joe Karlsson

Technology is better when it's weird and it's yours. Everything I write about runs in my house.

[More about me →](https://www.joekarlsson.com/about/)

[Bluesky](https://bsky.app/profile/joekarlsson.com) | [LinkedIn](https://www.linkedin.com/in/joekarlsson/) | [GitHub](https://github.com/JoeKarlsson)
