You can save this Dockerfile and then build the image with:
docker build -t algs4env .
After building the image, you can run a container with:
docker run -it --rm -v $(pwd):/workspace algs4env
This command maps your current directory (on your host) to /workspace in the container. This means you can edit files on your host system using your preferred editor/IDE, but then compile and run them inside the container environment, which has Java 11.0 and the algs4 library set up.
After building this Dockerfile, you can use the Checkstyle and Findbugs versions provided by the algs4 course. Note that the configurations are also downloaded and you can reference them when running these tools:
For Checkstyle:
checkstyle-algs4 <java-file-to-check>
For Findbugs:
findbugs-algs4 <class or jar file here>