[FOLIO-1544] switch to Alpine to shrink docker containers Created: 01/Oct/18  Updated: 11/Aug/20  Resolved: 28/Nov/19

Status: Closed
Project: FOLIO
Components: Continuous Integration
Affects versions: None
Fix versions: None

Type: Task Priority: P3
Reporter: Julian Ladisch Assignee: Unassigned
Resolution: Done Votes: 0
Labels: back-end, ci, core, platform-backlog, sprint48, sprint49
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original estimate: Not Specified

Issue links:
Blocks
is blocked by FOLIO-1722 Update FOLIO Docker image: Alpine 3.1... Closed
is blocked by FOLIO-1941 SPIKE: Revisit approach to the FOLIO ... Closed
is blocked by CIRC-185 Use Alpine docker container Closed
is blocked by MODINV-100 Use Alpine docker container Closed
Relates
relates to RMB-317 Error message about embedded Postgres... Closed
relates to RMB-318 Database config: Drop deprecated dot ... Closed
relates to FOLIO-2358 Use JVM features (UseContainerSupport... Closed
relates to UXPROD-1821 3rd party dependency upgrades (Q4 2019) Closed
relates to UXPROD-2214 3rd party dependency upgrades (Q1 2020) Closed
Sprint: CP: ready for planning
Development Team: Core: Platform

 Description   

Currently all java based docker containers except mod-authtoken are based on folioci/openjdk8-jre that is based on Debian stretch. mod-authtoken is based on folioci/openjdk8-jre-alpine that is based on Alpine.
Containers size comparison (compressed transfer size, not on-disk size):
186 MB https://hub.docker.com/r/folioci/openjdk8-jre/tags/
75 MB https://hub.docker.com/r/folioci/openjdk8-jre-alpine/tags/
The dockerfiles are at https://github.com/folio-org/folio-tools/tree/master/folio-java-docker/openjdk8

These are the sizes in today's folio/testing vagrant box:

vagrant@contrib-jessie:~$ docker images --format "table {{.Repository}}\t{{.Tag}}:\t{{.Size}}" | sort -n -k 3
REPOSITORY                        TAG:                   SIZE
nginx                             stable-alpine:         17.4MB
stripes                           latest:                43.4MB
folioci/mod-authtoken             2.0.2-SNAPSHOT.30:     115MB
folioci/mod-audit-filter          0.0.2-SNAPSHOT.10:     454MB
folioci/mod-inventory             9.5.1-SNAPSHOT.104:    459MB
folioci/mod-circulation           12.0.1-SNAPSHOT.172:   475MB
folioci/mod-codex-ekb             1.0.1-SNAPSHOT.66:     516MB
folioci/mod-configuration         5.0.1-SNAPSHOT.47:     516MB
folioci/mod-feesfines             14.2.5-SNAPSHOT.13:    516MB
folioci/mod-user-import           3.1.1-SNAPSHOT.31:     516MB
folioci/mod-calendar              1.0.3-SNAPSHOT.58:     517MB
folioci/mod-circulation-storage   6.1.1-SNAPSHOT.117:    517MB
folioci/mod-finance               1.0.1-SNAPSHOT.28:     517MB
folioci/mod-inventory-storage     12.8.3-SNAPSHOT.164:   517MB
folioci/mod-login                 4.5.1-SNAPSHOT.23:     517MB
folioci/mod-orders-storage        1.0.1-SNAPSHOT.14:     517MB
folioci/mod-password-validator    1.0.1-SNAPSHOT.7:      517MB
folioci/mod-permissions           5.4.0-SNAPSHOT.31:     517MB
folioci/mod-rtac                  1.1.1-SNAPSHOT.17:     517MB
folioci/mod-template-engine       1.0.0-SNAPSHOT.8:      517MB
folioci/mod-users-bl              4.0.3-SNAPSHOT.30:     517MB
folioci/mod-vendors               1.0.2-SNAPSHOT.26:     517MB
folioci/mod-notify                1.2.0-SNAPSHOT.51:     521MB
folioci/mod-tags                  0.2.0-SNAPSHOT.27:     521MB
folioci/mod-users                 15.3.0-SNAPSHOT.46:    521MB
folioci/mod-audit                 0.0.3-SNAPSHOT.15:     522MB
folioci/mod-codex-inventory       1.3.0-SNAPSHOT.59:     522MB
folioci/mod-codex-mux             2.2.3-SNAPSHOT.59:     522MB
folioci/mod-notes                 2.2.0-SNAPSHOT.64:     522MB
folioci/mod-login-saml            1.2.1-SNAPSHOT.28:     536MB
folioci/mod-kb-ebsco              1.0.2-SNAPSHOT.154:    848MB
folioci/mod-graphql               0.1.1000135:           919MB

Image size reported by docker images:

module Debian image size Alpine image size Debian image size overhead Debian image size overhead
mod-inventory 459 MB 90 MB 369 MB 410%
mod-graphql 1130 MB 304 MB 826 MB 272%
mod-inventory-storage 507 MB 139 MB 368 MB 265%
mod-users-bl 507 MB 139 MB 368 MB 265%
mod-orders-storage 508 MB 140 MB 368 MB 263%

Mem usage reported by docker stats after starting the docker container:

module Debian mem Alpine mem Debian mem overhead Debian mem overhead
mod-orders-storage 340.8 MiB 216.7 MiB 124.1 MiB 57%
mod-inventory-storage 328.1 MiB 227.1 MiB 101.0 MiB 44%
mod-users-bl 325.5 MiB 232.4 MiB 93.10 MiB 40%
mod-inventory 121.9 MiB 94.52 MiB 27.38 MiB 29%
mod-graphql 223.2 MiB 199.5 MiB 23.70 MiB 12%

There was some discussion on slack
https://folio-project.slack.com/archives/C210RP0T1/p1527251511000458
that postgresql-embedded doesn't work within Alpine but we probably do not need that because Jenkins runs the unit tests before the docker container is build and the Vagrant boxes run an own Postgres that they provide to the containers.



 Comments   
Comment by Julian Ladisch [ 02/Oct/18 ]

There were no objections agains Alpine docker containers at today's core backend meeting.

Comment by Heikki Levanto [ 02/Oct/18 ]

I think Kurt was right: We did talk about, and maybe tried to use Alpine containers earlier. We should check if there was a good reason not to. John Malconian might know something about it.

Comment by John Malconian [ 02/Oct/18 ]

The primary reason if I recall was the embedded postgres issue. I could not make it work it in Alpine and we already had documentation for many modules that included invoking the container at runtime with embedded postgres.

Comment by Julian Ladisch [ 02/Oct/18 ]

Using Alpine based containers for our Vagrant boxes does not prevent others from building non-Alpine-based containers.
Many other projects even provide both Alpine and non-Alpine based containers: https://hub.docker.com/_/openjdk/ https://hub.docker.com/_/postgres/ https://hub.docker.com/_/node/

Comment by Jakub Skoczen [ 28/Jan/19 ]

Adam Dickmeiss Julian Ladisch How does the image size converts into mem used?

Comment by Marc Johnson [ 26/Feb/19 ]

Jakub Skoczen John Malconian Wayne Schneider Is this something that the core platform team is still actively considering?

There are two outstanding pull requests for CIRC-185 Closed and MODINV-100 Closed that I propose are closed if we aren't intending to actively pursue this change.

Comment by John Malconian [ 26/Feb/19 ]

Marc Johnson I have no objections to using the Alpine base image.

Comment by Marc Johnson [ 28/Feb/19 ]

John Malconian Does that mean we want to try it? I can merge the pull requests that Julian Ladisch raised for mod-circulation and mod-inventory? (I haven't tested them)

Comment by John Malconian [ 28/Feb/19 ]

Marc Johnson - Let's stagger merging the PRs by a day apart so that we try one at a time.

Comment by Jakub Skoczen [ 28/Feb/19 ]

I'm good with that.

Comment by Jakub Skoczen [ 28/Feb/19 ]

John Malconian is anyone going to monitor if things are breaking?

Comment by Marc Johnson [ 28/Feb/19 ]

John Malconian Julian Ladisch Jakub Skoczen Any preference as to which goes first?

Comment by John Malconian [ 28/Feb/19 ]

I think the module changed first is irrelevant. If there are problems, we'll know fairly quickly.

Comment by Jakub Skoczen [ 26/Nov/19 ]

David Crossley isn't this done through the latest JDK8 containersupport migration?

Comment by David Crossley [ 26/Nov/19 ]

Yes, with FOLIO-2358 Closed we are switching all back-end modules to a new Alpine-based base image.

Comment by David Crossley [ 28/Nov/19 ]

Thanks Julian for your useful investigation.

Comment by David Crossley [ 28/Nov/19 ]

Closed. This was subsequently handled by FOLIO-2358 Closed and FOLIO-2334 Closed .

Generated at Thu Feb 08 23:14:07 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d.