This was a very simple Spring Boot application that is containerizered with Docker. I built this to understand the underlying technology from the ground up.
- Introduction
- Prerequisites
- Project Structure
- Getting Started
- Accessing the Application
- Docker Commands
- License
This is a simple Spring Boot application that has been containerized using Docker. The application consists of a single REST endpoint that returns "Hello, Docker!" when accessed.
Before you begin, ensure you have the following installed on your machine:
DockerDemo
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── demo
│ │ │ ├── DemoApplication.java
│ │ │ └── HelloController.java
├── target
├── Dockerfile
└── pom.xml
git clone https://github.com/taaare/docker-demo.git cd docker-demo
java -jar target/docker-demo-0.0.1-SNAPSHOT.jar You should see the application start and be accessible at http://localhost:8080.
docker build -t my-java-app . Run the Docker Container
docker run -p 8080:8080 my-java-app
Once the Docker container is running, open your web browser and navigate to:
You should see the message "Hello, Docker!".
Here are some useful Docker commands for managing your containers:
List Running Containers
docker ps Stop a Running Container
docker stop <container_id_or_name> Remove a Stopped Container
docker rm <container_id_or_name> View Container Logs
docker logs <container_id_or_name> Remove the Docker Image
docker rmi my-java-app
This project is licensed under the MIT License. See the LICENSE file for details.