1
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 made 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 picked up on the documentation, however I haven’t figured out what I’m doing wrong.
Thank you so much for the strength :)