Example maven jetty docker image running as non root user.
** updated ** Better example using multi-stage build, resulting in smaller image and offine packing of maven dependencies:
https://github.com/chrisjsimpson/maven-jetty-docker-multi-stage-builds
git@github.com:chrisjsimpson/maven-jetty-docker-non-root-example.git
cd maven-jetty-docker-non-root-example
Make sure you include the "." at the end:
docker build -t myjetty --no-cache -f Dockerfile .
docker run -p 8080:8080 myjetty
Visit http://localhost:8080/hello
- Get container id with
docker ps
- Exec into container with
docker exec -it <container-id> bash
- See
top
orhtop
to verify running as obp user (not root).
- Get container id with
docker ps
- Stop container with
docker stop <container-id>
https://github.com/carlossg/docker-maven#running-as-non-root
TODO: Package maven dependencies within build so no download needed during container run.