Skip to content

fix: add cacerts to ubi docker image #16928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 19, 2025

Conversation

kruskall
Copy link
Member

Motivation/summary

the ubi docker image doesn't include cacerts, use the chainguard base image to retrieve them so we can use dependency management to keep them updated

note: 8.x is not affected because it's using the ubuntu image but it seems we're vendoring the cacerts there so there's value in backporting this

Checklist

For functional changes, consider:

  • Is it observable through the addition of either logging or metrics?
  • Is its use being published in telemetry to enable product improvement?
  • Have system tests been added to avoid regression?

How to test these changes

  • print the x509.systemcertpool on startup
  • docker build --build-arg=GOLANG_VERSION=1.24.3 -t apm-server-test -f packaging/docker/Dockerfile .
  • run the image and observe the output

Related issues

Closes #16918

the ubi docker image doesn't include cacerts, use the chainguard
base image to retrieve them so we can use dependency management to
keep them updated
@kruskall kruskall requested a review from a team as a code owner May 15, 2025 20:10
@kruskall kruskall added backport-active-9 Automated backport with mergify to all the active 9.[0-9]+ branches backport-active-8 Automated backport with mergify to all the active 8.[0-9]+ branches labels May 15, 2025
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

Copy link
Member

@carsonip carsonip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q about backporting:

note: 8.x is not affected because it's using the ubuntu image but it seems we're vendoring the cacerts there so there's value in backporting this

Do you expect to remove the vendoring (packaging/docker/cacert.pem) and use chainguard /etc/pki and /etc/ssl instead?

@kruskall
Copy link
Member Author

Do you expect to remove the vendoring (packaging/docker/cacert.pem) and use chainguard /etc/pki and /etc/ssl instead?

yes

@kruskall kruskall enabled auto-merge (squash) May 19, 2025 10:59
@kruskall kruskall merged commit ad627b2 into elastic:main May 19, 2025
16 checks passed
@kruskall kruskall deleted the fix/docker-system-certs branch May 19, 2025 11:08
Copy link
Contributor

@Mergifyio backport 8.17 8.18 8.19 9.0

Copy link
Contributor

mergify bot commented May 19, 2025

backport 8.17 8.18 8.19 9.0

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request May 19, 2025
the ubi docker image doesn't include cacerts, use the chainguard
base image to retrieve them so we can use dependency management to
keep them updated

(cherry picked from commit ad627b2)

# Conflicts:
#	packaging/docker/Dockerfile
mergify bot pushed a commit that referenced this pull request May 19, 2025
the ubi docker image doesn't include cacerts, use the chainguard
base image to retrieve them so we can use dependency management to
keep them updated

(cherry picked from commit ad627b2)

# Conflicts:
#	packaging/docker/Dockerfile
mergify bot pushed a commit that referenced this pull request May 19, 2025
the ubi docker image doesn't include cacerts, use the chainguard
base image to retrieve them so we can use dependency management to
keep them updated

(cherry picked from commit ad627b2)

# Conflicts:
#	packaging/docker/Dockerfile
mergify bot pushed a commit that referenced this pull request May 19, 2025
the ubi docker image doesn't include cacerts, use the chainguard
base image to retrieve them so we can use dependency management to
keep them updated

(cherry picked from commit ad627b2)
mergify bot added a commit that referenced this pull request May 19, 2025
the ubi docker image doesn't include cacerts, use the chainguard
base image to retrieve them so we can use dependency management to
keep them updated

(cherry picked from commit ad627b2)

Co-authored-by: kruskall <[email protected]>
mergify bot added a commit that referenced this pull request May 19, 2025
* fix: add cacerts to ubi docker image (#16928)

the ubi docker image doesn't include cacerts, use the chainguard
base image to retrieve them so we can use dependency management to
keep them updated

(cherry picked from commit ad627b2)

# Conflicts:
#	packaging/docker/Dockerfile

* feat: fix conflicts

---------

Co-authored-by: kruskall <[email protected]>
mergify bot added a commit that referenced this pull request May 19, 2025
* fix: add cacerts to ubi docker image (#16928)

the ubi docker image doesn't include cacerts, use the chainguard
base image to retrieve them so we can use dependency management to
keep them updated

(cherry picked from commit ad627b2)

# Conflicts:
#	packaging/docker/Dockerfile

* Update Dockerfile

* Update Dockerfile

* feat: fix conflicts

---------

Co-authored-by: kruskall <[email protected]>
mergify bot added a commit that referenced this pull request May 19, 2025
* fix: add cacerts to ubi docker image (#16928)

the ubi docker image doesn't include cacerts, use the chainguard
base image to retrieve them so we can use dependency management to
keep them updated

(cherry picked from commit ad627b2)

# Conflicts:
#	packaging/docker/Dockerfile

* Update Dockerfile

* Update cacert.pem

* feat: fix conflicts

---------

Co-authored-by: kruskall <[email protected]>
@v1v
Copy link
Member

v1v commented May 19, 2025

I'm afraid this is not working

2025-05-19 13:26:39 UTC | => ERROR [stage-2  6/15] COPY --from=builder-certs /etc/ssl /etc/ssl                                                                                      0.0s
-- | --
  | 2025-05-19 13:26:39 UTC | ------
  | 2025-05-19 13:26:39 UTC | > [stage-2  6/15] COPY --from=builder-certs /etc/ssl /etc/ssl:
  | 2025-05-19 13:26:39 UTC | ------
  | 2025-05-19 13:26:39 UTC |  
  | 2025-05-19 13:26:39 UTC | 1 warning found (use docker --debug to expand):
  | 2025-05-19 13:26:39 UTC | - InvalidDefaultArgInFrom: Default value for ARG golang:${GOLANG_VERSION} results in empty or invalid base image name (line 9)
  | 2025-05-19 13:26:39 UTC | Dockerfile:84
  | 2025-05-19 13:26:39 UTC | --------------------
  | 2025-05-19 13:26:39 UTC | 82 \|     COPY --chmod=0755 licenses/ELASTIC-LICENSE-2.0.txt NOTICE.txt /licenses/
  | 2025-05-19 13:26:39 UTC | 83 \|     COPY --from=builder-certs /etc/pki /etc/pki
  | 2025-05-19 13:26:39 UTC | 84 \| >>> COPY --from=builder-certs /etc/ssl /etc/ssl
  | 2025-05-19 13:26:39 UTC | 85 \|
  | 2025-05-19 13:26:39 UTC | 86 \|     # Copy files world-readable, and create the data directory world-writeable,
  | 2025-05-19 13:26:39 UTC | --------------------
  | 2025-05-19 13:26:39 UTC | ERROR: failed to solve: cannot copy to non-directory: /var/lib/docker/overlay2/jlt62v0gc5mg3du3nc1xnp4d1/merged/etc/ssl/certs
  | 2025-05-19 13:26:39 UTC | make: *** [packaging.mk:53: build/docker/apm-server-ubi-8.18.2-SNAPSHOT.txt] Error 1

For the future, if the DRA package needs to run, the current alternative is to create a feature branch with the name feature/<your-branch-name>, then the automation will run and validate that things work as expected.

We can figure out how to enable the DRA validation by default, if needed in a follow up

@rubvs rubvs mentioned this pull request Jun 17, 2025
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-active-8 Automated backport with mergify to all the active 8.[0-9]+ branches backport-active-9 Automated backport with mergify to all the active 9.[0-9]+ branches
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing trusted root certificate authority in the docker image
4 participants