spring-cloud / spring-cloud/spring-cloud-config

I can't link spring cloud and docker. "spring-cloud-dependencies:2022.0.3", Spring Boot 3.0.6, java 17.0.7

Open
#2,323 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-for-triage
Dominant language
Java
Stars
2k
Forks
1.3k
Avg merge
2d 59m
Merged PRs (30d)
16

Description

Build gradle:

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:2022.0.2"
    }
}

docker run:

  ❯ docker run --name bib_authorization-service \                                                                                                                                                                                            ─╯
   -p 9000:9000 \
   -d dameergamlet/bib-authorization-service:1.0-SNAPSHOT \
  --restart=no

deployment:

jib {
    from {
        image = jibBaseDockerImage
    }
    to {
        image = "${dockerHubUsername}/bib-${project.name}:${project.version}"
        tags = [version, project.version] as List<String>
        auth {
            username = dockerHubUsername
            password = dockerHubPassword
        }
    }
    container {
        format = jibImageFormat
        getCreationTime().set(Instant.now().toString())
    }
}

Resutl:


                  ,--.  ,--.                                          ,--.
 ,--,--.,--.,--.,-'  '-.|  ,---. ,-----. ,---. ,---. ,--.--.,--.  ,--.`--' ,---. ,---.
' ,-.  ||  ||  |'-.  .-'|  .-.  |'-----'(  .-'| .-. :|  .--' \  `'  / ,--.| .--'| .-. :
\ '-'  |'  ''  '  |  |  |  | |  |       .-'  `)   --.|  |     \    /  |  |\ `--.\   --.
 `--`--' `----'   `--'  `--' `--'       `----' `----'`--'      `--'   `--' `---' `----'
 
Powered by Spring Boot 3.0.6
---------------------------------------------------------------------------------------------------------------------------------------------------

2023-08-28T15:28:10.269Z  INFO 1 --- [           main] s.t.a.AuthorizationServiceApplication    : Starting AuthorizationServiceApplication using Java 17.0.7 with PID 1 (/app/classes started by root in /)
2023-08-28T15:28:10.272Z  INFO 1 --- [           main] s.t.a.AuthorizationServiceApplication    : The following 1 profile is active: "default"
2023-08-28T15:28:10.316Z  INFO 1 --- [           main] o.s.c.c.c.ConfigServerConfigDataLoader   : Fetching config from server at : http://127.0.0.1:8888
2023-08-28T15:28:10.316Z  INFO 1 --- [           main] o.s.c.c.c.ConfigServerConfigDataLoader   : Exception on Url - http://127.0.0.1:8888:org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://127.0.0.1:8888/authorization-service/dev": Connection refused. Will be trying the next url if available
2023-08-28T15:28:10.316Z  WARN 1 --- [           main] o.s.c.c.c.ConfigServerConfigDataLoader   : Could not locate PropertySource ([ConfigServerConfigDataResource@439a8f59 uris = array<String>['http://127.0.0.1:8888'], optional = true, profiles = list['default']]): I/O error on GET request for "http://127.0.0.1:8888/authorization-service/dev": Connection refused
2023-08-28T15:28:11.552Z  INFO 1 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=9ba36e0a-f296-31f3-a926-c93f722e5b63
2023-08-28T15:28:11.864Z  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 9000 (http)
2023-08-28T15:28:11.872Z  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
...

But locally everything works without problems:


                  ,--.  ,--.                                          ,--.
 ,--,--.,--.,--.,-'  '-.|  ,---. ,-----. ,---. ,---. ,--.--.,--.  ,--.`--' ,---. ,---.
' ,-.  ||  ||  |'-.  .-'|  .-.  |'-----'(  .-'| .-. :|  .--' \  `'  / ,--.| .--'| .-. :
\ '-'  |'  ''  '  |  |  |  | |  |       .-'  `)   --.|  |     \    /  |  |\ `--.\   --.
 `--`--' `----'   `--'  `--' `--'       `----' `----'`--'      `--'   `--' `---' `----'
 
Powered by Spring Boot 3.0.6
---------------------------------------------------------------------------------------------------------------------------------------------------

2023-08-28T19:32:47.991+04:00  INFO 403957 --- [           main] s.t.a.AuthorizationServiceApplication    : Starting AuthorizationServiceApplication using Java 17.0.8 with PID 403957 (/home/damir/Documents/THESIS/PROJECT/bibraryteka-backend/authorization-service/build/classes/java/main started by damir in /home/damir/Documents/THESIS/PROJECT/bibraryteka-backend)
2023-08-28T19:32:47.993+04:00  INFO 403957 --- [           main] s.t.a.AuthorizationServiceApplication    : The following 1 profile is active: "default"
2023-08-28T19:32:48.038+04:00  INFO 403957 --- [           main] o.s.c.c.c.ConfigServerConfigDataLoader   : Fetching config from server at : http://127.0.0.1:8888
2023-08-28T19:32:48.038+04:00  INFO 403957 --- [           main] o.s.c.c.c.ConfigServerConfigDataLoader   : Located environment: name=authorization-service, profiles=[dev], label=null, version=9de19230902b655973e7555482bf0f852bebe9f1, state=null
2023-08-28T19:32:49.013+04:00  INFO 403957 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=769bf767-a828-32b8-8874-7e2c17f03dcf
2023-08-28T19:32:49.276+04:00  INFO 403957 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 9000 (http)
2023-08-28T19:32:49.282+04:00  INFO 403957 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-08-28T19:32:49.282+04:00  INFO 403957 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.8]
...

I can't link spring cloud and docker.

If someone was able to solve this problem - write. I can say for sure that there were no problems in another project with the same configuration.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Gradle dependencyManagement and Jib deployment blocks, then compare the docker run command and container startup logs with the local logs. Check the container's ability to reach the config server at http://127.0.0.1:8888; done means the Dockerized service locates its configuration and starts consistently with the local run.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java, spring-boot
Domain
backend, cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.