Coder Social home page Coder Social logo

docker-springboot-rest's Introduction

docker-springboot-rest

This service will be used to learn the dockerization

Steps

  1. Create a springboot rest application
  2. Create Docker file (created at the root folder)

Docker File commands

FROM openjdk:11 VOLUME /tmp COPY target/*.jar app.jar ENTRYPOINT ["java","-jar","/app.jar"]

Installed openjdk using FROM command. FROM will be the starting point always in a docker file Copied the jar file from target to app.jar Run the Jar file using the ENTRYPOINT command. ENTRYPOINT is used to run the executables

  1. Build the springboot rest application - build & install. jar will be created at target folder
  2. Create the docker image by build the docker file

docker build -t jobytchacko/springboot-rest-jc:1.0.0 .

docker image will be created. If we need to see the docker image list, run the following command docker images

  1. Run the docker image

docker run -p 9090:9090 jobytchacko/springboot-rest-jc:1.0.0

the docker and application will be running. Java log can be seen

  1. Verify the successfull run by hitting the rest url in browser http://localhost:9090/greeting

To see the list of images created

docker images

To see the list of running docker containers

docker ps

To see the list of docker containers exited

docker ps -a

To push the docker image to huub

docker push jobytchacko/springboot-rest-jc:1.0.0

Refer docker commands below https://collabnix.com/docker-cheatsheet/

docker-springboot-rest's People

Contributors

jobytchacko avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.