Skip to content
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

Is there a plan to make an alpine build of mysql? #179

Closed
ashrafuzzaman opened this issue Jun 18, 2016 · 37 comments
Closed

Is there a plan to make an alpine build of mysql? #179

ashrafuzzaman opened this issue Jun 18, 2016 · 37 comments
Labels
Request Request for image modification or feature

Comments

@ashrafuzzaman
Copy link

No description provided.

@yosifkit
Copy link
Member

yosifkit commented Jul 5, 2016

I think this comment is our current response. ie, we want to be sure that upstream supports running it on Alpine Linux.

I am especially hesitant with regards to the non-glibc: musl-libc, since it has caused issues in the past.

@ltangvald
Copy link
Collaborator

Yeah, currently MySQL doesn't build on Alpine, unfortunately.

@tjlee
Copy link

tjlee commented Nov 30, 2016

+1

@veqryn
Copy link

veqryn commented Jan 3, 2017

Now that postgres (from your comment above) and many other containers (node, etc) have official alpine variants, is it time to revisit this?

@ltangvald
Copy link
Collaborator

I think improvements in the alpine c library now allows MySQL to build. Official support from Oracle isn't there, but we may be able to take another look at it.

@armpogart
Copy link

Is PR welcomed for alpine build, I was using recently alpine built mysql on our staging servers and it runs so far without problems.

@armpogart
Copy link

So I've found that we are using mariadb on staging and mysql doesn't compile currently with musl, see corresponding bug

@edmorley
Copy link
Contributor

edmorley commented Jun 14, 2017

So I've found that we are using mariadb on staging and mysql doesn't compile currently with musl, see corresponding bug

The last comment in MySQL ticket #80322 says that compilation on alpine is fixed for MySQL 8.0.2.

I wonder if they'd be open to a backport to 5.6/5.7?

Or if not, then perhaps a good first step would be adding an alpine config for just the MySQL 8.x image?

@armpogart
Copy link

Yeah, I've noticed that ticket, will try to compile mysql under alpine in coming week, if it succeeds, I'll be happy to give PR with alpine image as soon as stable MySQL 8.x is released. Don't know if there are any plans to backport those fixes (changes) to 5.6 and 5.7.

@ltangvald
Copy link
Collaborator

Note that the ticket lists it as fixed in 8.0.2, which is not yet released.

I'm working on a template system for the images (so we can offer OracleLinux-based ones without breaking every image out there that extends the Debian-based images). Once that's in I think adding alpine images is a good idea.

@ufoscout
Copy link

It would be the top if #255 is also solved in this new alpine based image.

@ltangvald
Copy link
Collaborator

One other issue is that even if the build is fixed, unless MySQL gets official Alpine support we won't build and publish packages for it.

@franz-josef-kaiser
Copy link

From the referenced MySQL ticket:

[27 Apr 16:05] Paul Dubois
Posted by developer:
Noted in 8.0.2 changelog.
MySQL now compiles on Alpine Linux.

I guess there's green light for an Alpine version.

@AyushyaChitransh
Copy link

Is there any PR going on for this issue?

@almereyda
Copy link

@AyushyaChitransh From looking at https://github.com/docker-library/mysql/pulls I don't see any pending one.

@AyushyaChitransh
Copy link

So I guess there are currently plans to develop it and it is yet to be started.

@karser
Copy link

karser commented Oct 26, 2017

I use leafney/docker-alpine-mysql image, it installs mysql from alpine packages

@armpogart
Copy link

I guess we still need to wait for the MySQL 8 release, as it is the first release to officially support alpine linux.

@tianon
Copy link
Member

tianon commented Oct 26, 2017 via email

@denismakogon
Copy link

Okay, it's been a while! Any progress on this one?

@tianon
Copy link
Member

tianon commented Dec 26, 2017

I think #179 (comment) is still accurate (but perhaps @ltangvald can comment further as to whether Oracle has decided to officially support MySQL on Alpine):

... unless MySQL gets official Alpine support we won't build and publish packages for it.

@marcj
Copy link

marcj commented Jan 13, 2018

@karser

I use leafney/docker-alpine-mysql image, it installs mysql from alpine packages

apk add mysql mysql-client

Sorry, but that installs MariaDB, not MySQL.

@ltangvald
Copy link
Collaborator

MySQL 8.0 does now build with alpine, and we've done some work on creating Docker images, but there are a couple of issues:

  • MySQL dependencies add much more to the size than those of PG, so you end up with an image of ~150MB instead of ~40MB
  • Oracle doesn't publish MySQL for Alpine, so image build would also need to build the server (but this is also true for PG, I think?)

@tianon
Copy link
Member

tianon commented Feb 17, 2018

@ltangvald I'd be very curious how you managed to get down to ~150MB -- I've done some work on this and only got as low as ~196MB, and that's manually pruning a number of things, especially extra binaries (loosely based on what the -core packages include)

PostgreSQL does indeed build from source on Alpine, so that's not a big deal -- on my 12-core system I'm able to build the Alpine image I've been working on in ~9 minutes, and we've got a really beefy arm64v8 system I've been testing on as well that builds in a similar time frame, which is perfectly reasonable IMO (it'll be slower on our AWS amd64 workers, but such is life).

Honestly, I think even ~196MB for an Alpine image is still pretty interesting compared to ~343MB for the Debian alternative.

@neumayer
Copy link

We built alpine packages very similar to the minimisation used for the mysql-community-server-minimal rpm (that in turn is used for the mysql/mysql-server image). The differences there are that the oraclelinux:7-slim one is 246MB, and the alpine one around 150MB (talking 8.0 now). The savings in size come mostly from the removal of binaries. Also, the run script currently depends on bash and mysql still has a runtime dependency on gcc (this would be the differences to a "pure" alpine binary). Note that the pg binary itself is 8MB whereas mysql is 40MB, PG is written in C if I'm not mistaken.

Like @ltangvald mentioned the alpine thing comes at the cost of having to have Oracle support for it in place, currently difficult to prioritise on our end (although we do have a working prototype, the infamous ~150MB alpine image).

Maybe it's enough in terms of size if we try to get the official and supported Oracle one based on Oracle linux in? This would make use have a 246MB image for free (and it is supported and we probably can maintain that in the future, especially if it is identical or easily generated from the mysql/mysql-server one).

We'll discuss that a bit more internally and hopefully we'll be able to make more concrete suggestions soon. Our main interests here are to keep the duplication of code (run scripts mainly, but also the Dockerfiles) to a minimum in order to be able to maintain and support and help.

@tianon if you have a pr or branch with your alpine sources I can comment on what is the difference with my prototype. Maybe if you take a look at https://github.com/mysql/mysql-server/blob/8.0/packaging/rpm-docker/mysql.spec.in that can also help.

@wglambert wglambert added the Request Request for image modification or feature label Apr 24, 2018
@murbanowicz

This comment has been minimized.

@ltangvald
Copy link
Collaborator

For the upstream image I've experimented a little with stripping away any non-essential parts of the image, but doing a multi-stage build that only copies over what the MySQL binaries/entrypoint link to. This gives an OracleLinux-based image of about 100MB, vs the alpine image's 150MB (though you lose most OS functionality from it).
Would this be a relevant alternative, or are there other reasons besides size to make it alpine-based?

@yosifkit
Copy link
Member

As far as I know, Alpine images were introduced because they were significantly smaller, if that is not the case then I don't see a reason to have them. muslc and its strict POSIX compliance has been the source of more than a few issues across the official images. Here is a quick sampling of some of them:

docker-library/python#211
docker-library/postgres#276
docker-library/postgres#327
docker-library/docs#904
docker-library/ruby#196
docker-library/php#612

FYI, multi-stage builds are not supported by offical-images: docker-library/official-images#3383

@for0231

This comment has been minimized.

@FrancescoBorzi

This comment has been minimized.

@therealplato

This comment has been minimized.

@kibertoad

This comment has been minimized.

@jairmedeiros

This comment has been minimized.

@LoneRifle
Copy link

For the upstream image I've experimented a little with stripping away any non-essential parts of the image, but doing a multi-stage build that only copies over what the MySQL binaries/entrypoint link to. This gives an OracleLinux-based image of about 100MB, vs the alpine image's 150MB (though you lose most OS functionality from it).
Would this be a relevant alternative, or are there other reasons besides size to make it alpine-based?

Apologies for reviving this stale discussion, but I thought to point out that other than size, Alpine focuses quite a bit on security too. Notably, their official about page states that userland binaries are compiled with stack-smashing protection.

@tianon
Copy link
Member

tianon commented Jun 7, 2022

I think #179 (comment) is still accurate (but perhaps @ltangvald can comment further as to whether Oracle has decided to officially support MySQL on Alpine):

... unless MySQL gets official Alpine support we won't build and publish packages for it.

(To this end, I'm going to close this issue -- we will revisit if/when Oracle officially supports Alpine Linux. 👍)

@tianon tianon closed this as completed Jun 7, 2022
@marc-mabe
Copy link
Contributor

Haven't tried, but according to MySQL changelog there's a Bugfix...

MySQL did not build correctly using the musl version of libc.

@tianon
Copy link
Member

tianon commented Feb 28, 2024

I'm guessing that's not intended to imply explicit support for musl libc, but rather that applying a best-effort bugfix for musl (likely with a low maintenance burden) doesn't hurt them and helps downstreams like Alpine Linux continue to package and distribute their project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Request Request for image modification or feature
Projects
None yet
Development

No branches or pull requests