Skip to content

[8.19] Update docker default base to Ubuntu 24.04 #128534

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 4 commits into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* This class models the different Docker base images that are used to build Docker distributions of Elasticsearch.
*/
public enum DockerBase {
DEFAULT("ubuntu:20.04", "", "apt-get", "dockerfiles/default/Dockerfile"),
DEFAULT("ubuntu:24.04", "", "apt-get", "dockerfiles/default/Dockerfile"),

// "latest" here is intentional, since the image name specifies "8"
UBI("docker.elastic.co/ubi8/ubi-minimal:latest", "-ubi8", "microdnf", "Dockerfile"),
Expand Down
9 changes: 5 additions & 4 deletions distribution/docker/src/docker/dockerfiles/default/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,15 @@ package_manager,
" ${package_manager} update && \n" +
" ${package_manager} upgrade -y && \n" +
" ${package_manager} install -y --no-install-recommends \n" +
" ca-certificates curl netcat p11-kit unzip zip ${docker_base == 'cloud' ? 'wget' : '' } && \n" +
" ca-certificates curl netcat-openbsd p11-kit unzip zip ${docker_base == 'cloud' ? 'wget' : '' } && \n" +
" ${package_manager} clean && \n" +
" rm -rf /var/lib/apt/lists/*"
) %>

RUN groupadd -g 1000 elasticsearch && \\
adduser --uid 1000 --gid 1000 --home /usr/share/elasticsearch elasticsearch && \\
adduser elasticsearch root && \\
RUN userdel -r ubuntu && \\
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ubuntu 24.04 provides a default 'ubuntu' user. best practices I found suggest to just remove it before adding our own user.

groupadd -g 1000 elasticsearch && \\
useradd --uid 1000 --gid 1000 --home-dir /usr/share/elasticsearch --create-home elasticsearch && \\
usermod -aG root elasticsearch && \\
chown -R 0:0 /usr/share/elasticsearch

ENV ELASTIC_CONTAINER=true
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog/128534.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 128534
summary: "Update default docker base image to Ubuntu 24.04"
area: Packaging
type: upgrade
issues: []