I'm new to using Docker and need to use a lean OpenJDK 17 base-image to create an image of a Java web application and disable the ability of a user to log into a running container.
I've tried to use amazoncoretto 17 alpine image which purportedly has shell access disabled.
FROM amazoncorretto:17-alpine3.15
ENTRYPOINT ["java","-jar","/myapp.jar"]
But still you can log in to a container created off of this image, using docker exec -it my-container sh
, which I need to prevent.
What is the best way of accomplishing this? Thanks in advance.