Giter Club home page Giter Club logo

robot-server-app's Introduction

Spring boot

Build Spring boot application with Docker

Platform Framework License

About Project

This is a simple spring boot application with the basic details of docker implementation.

Repository contains

  • Spring boot application source code.
  • Docker file.

How it works using docker container

  • Create a simple spring boot application.
  • Create a docker file under parent directory.
  • Paste the following code in the docker file.
FROM openjdk:11-jre
VOLUME /tmp
ADD target/springBootDocker-1.0.0.jar springBootDocker.jar
ENTRYPOINT ["java","-jar","/springBootDocker.jar"]

FROM openjdk:11-jre
Here we are creating a docker image of openJre 11. And it will act as the parent image of our application.

VOLUME /tmp
This line is for allocating a folder to install our application. Because when we are executing our application tomcat needs space to create a work folder.

ADD target/springBootDocker-1.0.0.jar springBootDocker.jar
By this line, we are just specifying the path of the executable jar file and assign it to the "springBootDocker.jar" named file.

ENTRYPOINT ["java","-jar","/springBootDocker.jar"]
Here we are mentioning the comment that used to run the jar file in through the cmd.

  • Go to the spring boot application root directory open the cmd and create jar file using following command mvn clean install

    Docker Commands

  • Execute the following docker command to create the docker image.
    docker build -t <imagename> .
    • Here "-t" is used for mention the tag of container.
    • Our docker file is present in the same directory where we are executing this command. That is why we mentioned a dot at last of to commend
  • To list the created docker images please use the following command. And make sure that our docker image is in the list.
    docker image ls
  • Now it is time to run the docker image. Use the following command to run the docker image.
    docker run -p8080:8080 <imagename>
    • Here java application will be running inside the docket container , so we need to expose the application running port to outside the container. "-p8080:8080" is the command which expose the port to outside the docket container.

Thanks :)

robot-server-app's People

Contributors

novoland avatar vishnuviswam 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.