https://github.com/andreeadraghici/spring-quickstart
SpringBoot with Docker container Demo
https://github.com/andreeadraghici/spring-quickstart
demo docker docker-compose docker-image maven spring-boot web
Last synced: about 1 month ago
JSON representation
SpringBoot with Docker container Demo
- Host: GitHub
- URL: https://github.com/andreeadraghici/spring-quickstart
- Owner: AndreeaDraghici
- Created: 2025-01-18T02:55:14.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2025-01-18T12:42:29.000Z (3 months ago)
- Last Synced: 2025-01-28T16:39:26.371Z (3 months ago)
- Topics: demo, docker, docker-compose, docker-image, maven, spring-boot, web
- Language: Java
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Getting Started
## Reference Documentation
For further reference, please consider the following sections:
- [Official Apache Maven Documentation](https://maven.apache.org/guides/index.html)
- [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/3.4.1/maven-plugin)
- [Create an OCI Image](https://docs.spring.io/spring-boot/3.4.1/maven-plugin/build-image.html)---
## Build and Run the Application
### Using Maven
1. **Build the Application:**
```bash
mvn clean package2. **Run the Application:**
`java -jar target/demo-0.0.1-SNAPSHOT.jar`
3. **Access the Application: Open your browser and navigate to:**
http://localhost:8081
---
## Docker Container Overview
### Build and Run with Docker Compose
1. **Build the Docker Image:**
`docker-compose up --build`
2. **Stop and Remove the Containers:**
`docker-compose down`
---
## Manual Docker Commands
### If you prefer running Docker commands manually:
1. **Build the Docker Image:**
` docker build -t demo-image:latest .`
2. **Run the Docker Container:**
`docker run -p 8081:8081 --name demo demo-image:latest`
3. **Stop and Remove the Container:**
`docker stop demo`
`docker rm demo`
---
### Notes
* Ensure you have Java 17+, Maven, and Docker installed on your system.
* If port 8081 is already in use, update the docker-compose.yml or Dockerfile to use a different port.