distroless icon indicating copy to clipboard operation
distroless copied to clipboard

python3 image seems to work with ctypes, docs say otherwise

Open MShekow opened this issue 3 months ago • 3 comments

Describe the bug The docs claim that ctypes is not supported.

To Reproduce Using ctypes works just fine.

Following some commands from the official docs:

Start a container: docker run --rm -it gcr.io/distroless/python3 then type this in:

from ctypes import *
libc = CDLL("libc.so.6")
print(libc.rand())

Expected behavior

ctypes calls should not work.

MShekow avatar Aug 27 '25 13:08 MShekow

I'm not a python user, if you know the underlying reason, that'd be useful knowledge to share and we can update the docs.

loosebazooka avatar Nov 03 '25 20:11 loosebazooka

No, I don't. While I'm a Python user, I don't fiddle with low-level details such as "loading of system libraries" and why that would (not) work.

I'm curious how you are asking that question, given that Git claims that it was you who introduced this note about ctypes ;) - see https://github.com/GoogleContainerTools/distroless/commit/9e62fd26eb777f6617eaec7e45d70c2348dfa62d

MShekow avatar Nov 04 '25 05:11 MShekow

Yeah it's possible that I was just advised about that at the time... Either something changed or I was just wrong. I think the path forward is finding the right answer though.

loosebazooka avatar Nov 04 '25 12:11 loosebazooka