When it comes to production, it is recommended to use the official docker image for YugabyteDB. You can either obtain it from Docker Hub or build it yourself using the Dockerfile. If you are using CI/CD pipelines, it may be helpful to reduce the size of the image. One way to do this is to remove the debug symbols from the compiled binaries. These symbols are useful for troubleshooting but not essential for automated testing. If you encounter any issues, you can easily reproduce them using the regular image.
I have downloaded the standard image for YugabyteDB 2.20, and its size is 2.19 gigabytes.
$ docker pull yugabytedb/yugabyte:2.20.3.0-b68-aarch64
---
$ docker image ls yugabytedb/yugabyte:2.20.3.0-b68-aarch64
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/yugabytedb/yugabyte 2.20.3.0-b68-aarch64 99039f3276b8 3 weeks ago 2.19 GB
$
Here's a Dockerfile that removes all debug symbols from the executables and copies the remaining to a new image:
FROM yugabytedb/yugabyte:2.20.3.0-b68-aarch64 as stage
RUN strip $(find . -executable) ; true
#RUN dnf remove -y java-1.8.0-openjdk-headless geolite2-city glibc-all-langpacks
FROM scratch
COPY --from=stage / /
WORKDIR /home/yugabyte
CMD yugabyted start --background=false
I was able to reduce the size by half with this:
$ docker image ls yb-slim
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost/yb-slim latest b893d1d842d7 3 minutes ago 1.07 GB
Note that I left a line in the comments that removes 200MB for components that I think are useless, but I can't guarantee that it is safe.
It is important to understand the consequences of removing debug symbols. For example, if yb_debug_report_error_stacktrace
is set to see the whole stack trace on an SQL error, the trimmed image shows less information:
Top comments (0)