Skip to content

docker: trim the arm64 MySQL tarball install to what the server runs - #46

Merged
aparajon merged 1 commit into
release-24.0from
armand/trim-arm64-mysql-tarball
Nov 27, 2026
Merged

aparajon merged 1 commit into
release-24.0from
armand/trim-arm64-mysql-tarball

Conversation

@aparajon

@aparajon aparajon commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

On arm64 the mysql80 and mysql84 flavors install MySQL from Oracle's aarch64 tarball, because Oracle's Debian repo publishes no arm64 .deb for them. That tarball is a full distribution, not a server package, so the arm64 vttestserver image carries roughly a gigabyte that a server never runs.

This trims it to what the .deb flavors already produce on the other architectures.

What changes

docker/utils/install_dependencies.sh grows a trim_mysql_tarball_install, called from the existing cleanup section. It returns immediately unless the build is arm64 on mysql80 or mysql84, so no other flavor or architecture is touched. Every image that runs this script on those flavors gets the trim, so docker/lite and docker/mini shrink on arm64 along with vttestserver.

It removes four things the tarball ships and the image does not use, and strips mysqld:

Path arm64 before After
/usr/local/bin/mysqld 491M 61M (stripped)
/usr/local/bin/mysqld-debug 434M removed
/usr/local/lib/mecab 130M removed
/usr/local/lib/*.a 63M removed
/usr/local/include, /usr/local/man 1.3M removed
/usr/local total 1.7G 606M

Stripping is not a new risk: on amd64 the .deb mysqld is already stripped, at 69M against this 61M. strip leaves .dynsym alone, so plugins still resolve. binutils is installed for the strip and purged with --auto-remove; the resulting package set is identical to today's, verified with dpkg-query -W against the published image.

Why it has to happen here

Docker layers are additive, so this only works in the layer that unpacked the tarball. A consumer that deletes these files in its own FROM layer still downloads them.

Deleting downstream                      Deleting in the unpack layer

  layer: untar  1.7G  ◄── downloaded       layer: untar + trim  606M  ◄── downloaded
  layer: rm       0B  ◄── downloaded
  ─────────────────────────────────        ─────────────────────────────────
  pull cost     1.7G                       pull cost            606M
  disk usage    606M                       disk usage           606M

That is why the fix belongs in this script rather than in the images built on top of it.

Testing

The trim was built for real: vttestserver/Dockerfile.mysql84's runtime stage, built on arm64 from this branch, so the files are removed in the layer that unpacked them. Built from the same Dockerfile without the trim, the image is 4.33GB; with it, 2.48GB.

  • mysqld --version still reports 8.4.8, and mysqld --initialize, startup, DDL and DML, and mysqladmin shutdown all work.
  • dpkg-query -W returns a package set identical to the published 24.0.5-block.2-mysql84 image's, so purging binutils leaves nothing behind and takes nothing with it.
  • /usr/local/bin is intact apart from mysqld-debug. mysqladmin in particular survives, which mysqlctl shutdown falls back to when no shutdown hook is configured.
  • A consumer's full integration suite, running two-shard LocalScale clusters (vtcombo + mysqlctld) on an image built from this base, passes.

The trim is subtractive rather than a copy-forward of a chosen set, which is what keeps a binary like mysqladmin from going missing by omission.

The mysql80 arm64 path takes the same branch but was not built here.

This workflow builds both architectures on a pull request touching docker/utils/**, so the amd64 leg covers the untouched path and the arm64 leg builds the change itself.

On arm64 the MySQL flavors install from Oracle's aarch64 tarball, which is a
full distribution rather than a server package. It carries a debug build of
mysqld, the MeCab dictionaries, the static client libraries, and the headers
and manual pages, and its mysqld is unstripped where the .deb packages the
other architectures install ship a stripped one.

Drop the four and strip mysqld in the layer that unpacked them, so the arm64
image carries the same payload the .deb flavors already produce. Deleting them
from a later layer would not help: the layer that unpacked them is already in
the download.

/usr/local goes from 1.7G to 546M, and mysqld from 491M to 61M, against 69M for
the stripped .deb build on amd64. binutils is installed for strip and purged
with --auto-remove, leaving the package set unchanged.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Removing MySQL’s bundled MeCab configuration and dictionaries breaks parser initialization for consumers using those assets, preventing use of indexes declared with WITH PARSER mecab.

1 open issue
What changed in this PR

This PR reduces the arm64 MySQL payload in Vitess Docker images by trimming Oracle’s tarball installation in the same layer where it is unpacked.

Changes:

  • Adds cleanup limited to arm64 mysql80 and mysql84, removing selected bundled files and stripping mysqld.
  • Temporarily installs binutils for stripping, then purges it.
  • Runs cleanup before deleting apt package lists, leaving other architectures and flavors unchanged.
File Description
docker/​utils/​install_dependencies.sh Adds architecture- and flavor-specific tarball trimming to the existing cleanup phase.

Review effort: Balanced

Comment thread docker/utils/install_dependencies.sh Resolved
@aparajon
aparajon merged commit 736af13 into release-24.0 Nov 27, 2026
94 checks passed
@aparajon
aparajon deleted the armand/trim-arm64-mysql-tarball branch November 27, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants