Docker-compose: Issue while running the spring boot enabled and spring cloud config application

escort :

I want to run the Spring Boot enabled and spring cloud config project to deploy to Docker. The below is the docker-compose.yml file. But I'm getting the following error while running the file.

Error:

ERROR: yaml.parser.ParserError: while parsing a block mapping
  in "./docker-compose.yml", line 4, column 4
expected <block end>, but found '<block mapping start>'
  in "./docker-compose.yml", line 48, column 5

Below is my docker-compose.yml file:

    version: '3'

    services:
          discovery:
            image: pl.app.service/discovery-service:0.0.1-SNAPSHOT
            ports:
              - 8061:8061
          config:
            image: pl.app.service/config-service:0.0.1-SNAPSHOT
            volumes:
              - ./config-data:/config-data
            environment:
               - JAVA_OPTS=
               -DEUREKA_SERVER=http://discovery:8761/eureka
               -Dspring.cloud.config.server.native.searchLocations=/config-data
             depends_on:
              - discovery
             ports:
              - 8088:8088

      proxy-service:
        image: pl.app.service/proxy-service:0.0.1-SNAPSHOT
        environment:
          - JAVA_OPTS=
            -DEUREKA_SERVER=http://discovery:8761/eureka
        depends_on:
          - discovery
          - config
        ports:
            -8060:8060

      employee-service:
        image: pl.app.service/employee-service:0.0.1-SNAPSHOT
        environment:
          - JAVA_OPTS=
            -DEUREKA_SERVER=http://discovery:8761/eureka
            -Dspring.profiles.active=dev
        restart: on-failure
        depends_on:
          - discovery
          - config
        ports:
            -8090:8090

      department-service:
          image: pl.app.service/organization-service:0.0.1-SNAPSHOT
        environment:
          - JAVA_OPTS=
            -DEUREKA_SERVER=http://discovery:8761/eureka
            -Dspring.profiles.active=dev
        restart: on-failure
        depends_on:
          - discovery
          - config
        ports:
            -8091:8091

       organization-service:
          image: pl.app.service/organization-service:0.0.1-SNAPSHOT
        environment:
          - JAVA_OPTS=
            -DEUREKA_SERVER=http://discovery:8761/eureka
            -Dspring.profiles.active=dev
        restart: on-failure
        depends_on:
          - discovery
          - config
        ports:
            -8092:8092

I have tried multiple indentations changes for docker-compose.yml file.

The mentioned services are already built by maven. Need help in running the docker composer for the application.

codinghaus :

There are multiple errors.

  1. Make sure that you only use spaces for indentation (instead of tabs). If you are interested why tabs don't work within yaml files have a look at A YAML file cannot contain tabs as indentation
  2. put your ports into strings (e.g. - "8060:8060"instead of - 8060:8060)
  3. I think you are misusing environment variables. They should/must look like e.g.:

environment: - JAVA_OPTS - EUREKA_SERVER=http://discovery:8761/eureka - ANOTHER_ENV_VARIABLE=/config-data

Have a look at the docs for details: https://docs.docker.com/compose/environment-variables/

After fixing your docker-compose.yml you can validate your file by running docker-compose config inside of the directory where your docker-compose.yml is located.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Running Spring Boot application with Kafka in Docker-compose

Docker compose spring boot redis connection issue

Spring Security config ignored while running on Docker

Docker-compose - Providing XML based configuration to docker container running spring boot standalone application

Compilation error while running a spring boot application

Unable to load Spring Boot application running in Docker

docker compose problem while using spring boot mysql docker

How to deploy spring-cloud-config server in docker-compose?

Running Spring application issue

Runtime error while running a Spring Session + Spring Boot application

Spring Cloud Kubernetes - Spring boot fails to start when config reload is enabled

Spring Cloud Config Server using SSH key for Git and running in Docker

Docker file for running spring boot application on docker container?

Connect To Docker Compose MongoDb Via Spring boot application

docker-compose.yml for spring boot application using postgres

docker compose spring boot logs

Spring Boot application issue(bean creation error) when running on wildfly

Spring/Angular CORS issue while CORS is enabled

Error while running spring boot on external tomcat inside docker container

failed to initialize Tomcat while running Spring boot app with vaadin in docker

Spring Cloud Config Server without Spring Boot

Docker container running Spring Boot application not answering requests

Spring Boot Application Deployment Issue

Spring Boot Application - Maven Issue

Google Cloud Platform pipeline/container builder issue building docker image using COPY or ADD command for Spring Boot Java Application

Spring Boot Application with Spring Batch not Running Jobs

Spring Boot application not reading properties value from Spring Cloud Config Server

Integration tests in spring boot application with spring cloud

Cloud client config application do not get properties from Config Server Spring boot

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  3. 3

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  4. 4

    pump.io port in URL

  5. 5

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  6. 6

    BigQuery - concatenate ignoring NULL

  7. 7

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  8. 8

    Do Idle Snowflake Connections Use Cloud Services Credits?

  9. 9

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

  10. 10

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  11. 11

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  12. 12

    Generate random UUIDv4 with Elm

  13. 13

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  14. 14

    Is it possible to Redo commits removed by GitHub Desktop's Undo on a Mac?

  15. 15

    flutter: dropdown item programmatically unselect problem

  16. 16

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  17. 17

    EXCEL: Find sum of values in one column with criteria from other column

  18. 18

    Pandas - check if dataframe has negative value in any column

  19. 19

    How to use merge windows unallocated space into Ubuntu using GParted?

  20. 20

    Make a B+ Tree concurrent thread safe

  21. 21

    ggplotly no applicable method for 'plotly_build' applied to an object of class "NULL" if statements

HotTag

Archive