Install JDK as container

Is there is option to install JDK as a container ?

There are Docker images with a JDK installed, just search Docker Hub.

Or take a plain Docker image like Ubuntu or Alpine, and install your own JDK, preferably create a re-usable image with a Dockerfile.

Can I create with docker compose

Yes, you can run any container based on an image with Docker compose.