Skip to content

chrisjsimpson/maven-jetty-docker-non-root-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maven Jetty Docker run as non root user

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

Clone

git@github.com:chrisjsimpson/maven-jetty-docker-non-root-example.git 
cd maven-jetty-docker-non-root-example

Build

Make sure you include the "." at the end:

 docker build -t myjetty --no-cache -f Dockerfile .

Run

 docker run -p 8080:8080 myjetty

Visit http://localhost:8080/hello

Verify

  • Get container id with docker ps
  • Exec into container with docker exec -it <container-id> bash
  • See top or htop to verify running as obp user (not root).

Stop container

  • Get container id with docker ps
  • Stop container with docker stop <container-id>

See also

https://github.com/carlossg/docker-maven#running-as-non-root

TODO: Package maven dependencies within build so no download needed during container run.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published