I'm studying docker, and I'm trying to run a small application made in Springboot along with Mongodb in a single container.
I wrote the following Dockerfile:
FROM openjdk:8-jre-alpine
ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
JAVA_OPTS=""
ADD /target/*.jar /app.jar
EXPOSE 8080
CMD java ${JAVA_OPTS} -jar /app.jar
I also did a docker-compose.yml
version: "2"
services:
mongodb:
image: mongo
ports:
- "27017:27017"
springapp:
build: .
depends_on:
- mongodb
ports:
- 8080:8080
links:
- mongodb
When I start the application, I get "Connection Refused". Below is my application.yml:
spring:
data:
monbodb:
host: mongodb
port: 27017
database: customer
This example of docker-compose.yml I got in the documentation, however I still have not figured out what I'm doing wrong.
Many thanks for the strength:)