As a Newcomer to Docker, I would recommend you to read at least the best practice of Docker.
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#general-guidelines-and-recommendations
To Answer your Question "How to to build a container yourself" start with a simple Hello World to understand the usage plus Intention of Docker.
After that, just try To build your own Docker, you will need a
Dockerfile, which is the building instructions for a Docker Container.
How to write such a Dockerfile: This should be your Task to check the best Pratice above
For additional Examples, here is a Dockerfile of mine (Ive used Golang instead of Java). After you have read the documentation I suspect you will understand it, if not just ask specific.
FROM golang:1.10.3 as builder
WORKDIR /go/src/git....../yourName/dht22
COPY . .
RUN go tool dist list | grep arm \
&& apt-get update \
&& apt-get install -y build-essential gcc-arm-linux-gnueabi \
&& go get ./... \
&& CC=arm-linux-gnueabi-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm
GOARM=6 go build -a -o app dht22.go
FROM arm32v6/alpine:latest
WORKDIR /go/src/git...../yourName/dht22
COPY --from=builder /go/src/git..../yourName/dht22 /app
CMD ['/app']