I\'m using spring boot and am trying to set it up with Docker. I\'ve tried everything I could find on google and nothing seems to get me going. I\'
I ended up building the docker image by myself without the plugin:
docker build -f Dockefile .
And my Dockefile (has been renamed):
FROM java:8-jdk
EXPOSE 8080
#VOLUME /tmp
ADD target/app-0.0.1-SNAPSHOT.jar /opt/demo/app-0.0.1-SNAPSHOT.jar
CMD ["java","-jar","/opt/demo/app-0.0.1-SNAPSHOT.jar"]
I then run it like so:
docker run
I just couldn't get the mvn plugin to work!
Furthermore I ended up creating a docker-compose.yml
which makes things a lot simpler!!!
You define properties such as the ports you want open, dockerfile location, and run docker-compose, and it'll magically build+run the docker image!
Example docker-compose.yml that I'm using:
version: '2'
services:
web:
build: .
ports:
- "8080:8080"
build references the Dockerfile location. *Note you may need to the Dockerfile+yml file to be in the same location!
ports reference the ports I want open. Now I can goto localhost:8080 and my request will be forwarded to the docker container.
Read more on docker container here:
https://docs.docker.com/compose/gettingstarted/