Skip to content

Demo project for docker with spring boot project for employee apis

Notifications You must be signed in to change notification settings

amit-maurya-507464/spring-boot-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

  1. Docker build command
    docker build -t employee .

  2. Docker run command
    docker run -p 8080:8080 employee
    --> run docker in the background
    docker run -d -p 8080:8080 employee-api

  3. Access the H2 console to verify the database setup:
    Open your web browser and go to http://localhost:8080/h2-console.
    Use the following details to log in:
    a. JDBC URL: jdbc:h2:mem:testdb
    b. Username: sa
    c. Password: password

  4. Test the Application
    Use tools like Postman or Curl to test the API endpoints:

GET all employees: GET http://localhost:8080/api/employees
GET an employee by ID: GET http://localhost:8080/api/employees/{id}
POST a new employee: POST http://localhost:8080/api/employees
PUT update an employee: PUT http://localhost:8080/api/employees/{id}
DELETE an employee: DELETE http://localhost:8080/api/employees/{id}

  1. Verifying the Container is Running
    A. List Running Containers:
    You can list all running containers using:
    docker ps
    This will show you all the containers that are currently running, including the employee-api container.

B. Check Logs:

To check the logs of the running container (replace <container_id> with the actual container ID from the docker ps output):

docker logs <container_id>

C. Stopping the Container
If you need to stop the container, you can do so with:

docker stop <container_id>

D. To remove the container after stopping it, use:

docker rm <container_id>

  1. Access the swagger ui
    http://localhost:8080/swagger-ui/index.html

About

Demo project for docker with spring boot project for employee apis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published