Coder Social home page Coder Social logo

spring-boot-docker's Introduction

spring-boot-docker

Getting Started with Docker using Spring Boot

Maven Build the code :

mvn install

Run the Spring Boot application :

java -jar target/spring-boot-docker-0.1.0.jar

Verification :

http://localhost:8080

Docker

  1. Docker Build

docker build --compress --force-rm -t {Docker_Hub_Username}/{Docker_Hub_RepoName}:{Tag} .

Example : docker build -t vinodjayachandran/spring-boot-docker:1.0 .

  1. On successful execution of above command, it will create a docker image in your local which you can verify with the below command. It will list the set of images on your machine.

docker images

  1. Run Docker image locally on a container with a name for the container.

Example : docker run -p 8080:8080 -t vinodjayachandran/spring-boot-docker:1.0 --name=MyTestContainer

  1. Verify if the container is up. Your image will be listed with status as up along with container id. Without the option --all it will list only running containers

Example

$ docker container ls --all

  1. Stop/Start the container with container id retrieved from Step 4. After stopping the container you verify again with commands from Step 4

Example

docker stop {CONTAINER ID}

docker start {CONTAINER ID}

  1. Rename container

docker rename {EXISTING CONTAINER NAME OR ID} NEW_NAME

  1. Delete container

docker rm {EXISTING CONTAINER NAME OR ID}

  1. Remove one or more images

  2. Push the docker image to docker hub/registry

    Login to Docker Hub/Registry

        $ docker login --username={userName} --password={pwd}
    

    Providing password directly on CLI isn't recommended. From a security perspective, we can have the password stored in a file and provided at run time through stdin

    Push the image to docker hub

  3. Configure automated builds from GitHub and BitBucket

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.