latest 11-jdk on ubuntu jammy breaks keytool -importcert
gmolkvk opened this issue ยท 13 comments
I am using your images by using maven:3.8.5-eclipse-temurin-11 - see https://github.com/carlossg/docker-maven/blob/master/eclipse-temurin-11/Dockerfile#L1
Adding trusted certificates to the java truststore is failing on the new ubuntu jammy image
Using :11-jdk-focal
FROM eclipse-temurin:11-jdk-focal
RUN keytool -importcert -noprompt -file /usr/local/share/ca-certificates/extra/rootca.crt -cacerts -storepass changeit -alias 'custom root ca'
Certificate was added to keystore
Using :11-jdk
FROM eclipse-temurin:11-jdk
RUN keytool -importcert -noprompt -file /usr/local/share/ca-certificates/extra/rootca.crt -cacerts -storepass changeit -alias 'custom root ca'
[0.004s][warning][os,thread] Failed to start thread - pthread_create failed (EPERM) for attributes: stacksize: 1024k, guardsize: 4k, detached.
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Cannot create worker GC thread. Out of system resources.
# An error report file with more information is saved as:
# //hs_err_pid6.log
The command '/bin/sh -c keytool -importcert -noprompt -file /usr/local/share/ca-certificates/extra/rootca.crt -cacerts -storepass changeit -alias 'custom root ca'' returned a non-zero code: 1
The only statement changed between builds is the Dockerfile FROM statement
eclipse-temurin:17-jdk same problem
the change to jammy was done in docker-library/official-images#12516
I think if your docker engine is upgraded to the latest that resolves this issue. Can folks give that a try?
Will try and let you know how it goes
I can confirm that updating to docker-engine 20.10.16 resolved the issue for me.
Hi folks! I had a similar issue, and your discussions here and there helped me to investigate. So I figured I could share my findings:
the change to jammy was done in docker-library/official-images#12516
Yes. All eclipse-temurin:<version>-jdk
became based on the latest ubuntu LTS 22.04 Jammy.
You have to specify eclipse-temurin:<version>-jdk-focal
if you want to use the image with the previous ubuntu LTS 20.04 Focal as a base image.
I can confirm that updating to docker-engine 20.10.16 resolved the issue for me.
This is probably due to this PR on docker.
Latest glibc will attempt to use clone3(). As a result, most newer distro (ubuntu Jammy 22.04, but probably others) will fail unless we allow the syscall (in docker, in systemd...).
To reproduce:
$ wget "https://raw.githubusercontent.com/moby/moby/c7cd1b9436ac381747a5c52dddac5a66f97c61f8/profiles/seccomp/default.json" -O before_clone3.json
# the seccomp profile right before PR https://github.com/moby/moby/commit/9f6b562dd12ef7b1f9e2f8e6f2ab6477790a6594
docker run --security-opt seccomp=before_clone3.json -it --entrypoint /bin/bash eclipse-temurin:17-jdk # (should also fail with any ubuntu 22.04 really...)
root@e2a511de29d4:/# curl google.com
curl: (6) getaddrinfo() thread failed to start
root@e2a511de29d4:/#
Permanent fix:
- upgrade docker, or expect all newer, up-to-date base images to fail in the future
Mitigation/workaround:
docker run --security-opt seccomp=your_policy_which_allows_clone3.json ....
(docs)- downgrade your (base) images (the
-focal
should stay available for some 2years, IF the maintainers of docker's official images wait for the next ubuntu LTS to drop ubuntu Focal/20.04)
Can someone clarify why updating docker fixes this? Thanks!
Can someone clarify why updating docker fixes this? Thanks!
#215 (comment) explains it.
Hi folks! I had a similar issue, and your discussions here and there helped me to investigate. So I figured I could share my findings:
the change to jammy was done in docker-library/official-images#12516
Yes. All
eclipse-temurin:<version>-jdk
became based on the latest ubuntu LTS 22.04 Jammy. You have to specifyeclipse-temurin:<version>-jdk-focal
if you want to use the image with the previous ubuntu LTS 20.04 Focal as a base image.I can confirm that updating to docker-engine 20.10.16 resolved the issue for me.
This is probably due to this PR on docker.
Latest glibc will attempt to use clone3(). As a result, most newer distro (ubuntu Jammy 22.04, but probably others) will fail unless we allow the syscall (in docker, in systemd...).
To reproduce:
$ wget "https://raw.githubusercontent.com/moby/moby/c7cd1b9436ac381747a5c52dddac5a66f97c61f8/profiles/seccomp/default.json" -O before_clone3.json # the seccomp profile right before PR https://github.com/moby/moby/commit/9f6b562dd12ef7b1f9e2f8e6f2ab6477790a6594 docker run --security-opt seccomp=before_clone3.json -it --entrypoint /bin/bash eclipse-temurin:17-jdk # (should also fail with any ubuntu 22.04 really...) root@e2a511de29d4:/# curl google.com curl: (6) getaddrinfo() thread failed to start root@e2a511de29d4:/#Permanent fix:
- upgrade docker, or expect all newer, up-to-date base images to fail in the future
Mitigation/workaround:
docker run --security-opt seccomp=your_policy_which_allows_clone3.json ....
(docs)- downgrade your (base) images (the
-focal
should stay available for some 2years, IF the maintainers of docker's official images wait for the next ubuntu LTS to drop ubuntu Focal/20.04)
This is excellent research! To expand on this just a little bit:
glibc 2.34 and newer contain this commit, which defaults to using clone3
. Ubuntu Jammy ships with 2.35, and thus contains this change in behavior. This was not available for Docker until PR 42681 (fix for 42680). Which is available starting with version 20.10.10.
Just out of curiosity, has anyone had success with the seccomp workaround?
@keeganwitt I have tried it, but it seems that you cannot override the base seccom profile (this is hard-coded). Here is the relevant change in Docker moby/moby#42681
@keeganwitt I have tried it, but it seems that you cannot override the base seccom profile (this is hard-coded). Here is the relevant change in Docker moby/moby#42681
I also tried it.
Using the lastest default.json or the default.json after the commit, both of them failed.
# the latest file
wget https://raw.githubusercontent.com/moby/moby/master/profiles/seccomp/default.json -O clone3_default.json
# or the fixed issue committed file
wget https://raw.githubusercontent.com/berrange/moby/9f6b562dd12ef7b1f9e2f8e6f2ab6477790a6594/profiles/seccomp/default.json -O clone3_default.json
cat clone3_default.json | grep clone3
docker run --security-opt seccomp=clone3_default.json -it --entrypoint /bin/bash eclipse-temurin:8u362-b09-jdk-jammy@sha256:8f16a677c2270ba982f998b8eb3869a4bfbe0aa385ebf786d33ce23d3e4ff3bc
curl www.baidu.com
My docker is binary linux 20.10.9
If you cannot update Docker a workaround is described here (Option 3): https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.14.0#faccessat2