Run the Eureka registry and Spring Boot client as separate containers on the same Docker network. The registry listens on port 8761; the client must use the registry’s Docker-resolvable service name—not localhost—in its Eureka URL. Publish ports to the host only when you need access from outside that network.
How the two-container setup works
Eureka Server is a Spring Boot application enabled with @EnableEurekaServer. It provides a registry that Eureka clients use to register and discover services. A standalone local registry normally listens on port 8761 and disables its own registration and registry fetching. Clients need the Eureka client starter and a reachable service URL.
Docker gives each container its own network namespace. Inside the client container, localhost means the client container itself, not the Eureka container. Put both containers on a user-defined Docker network and address the registry by its container or service name.
Prepare the Eureka server
Use the Spring Boot and Spring Cloud versions that are compatible with one another according to the current Spring Cloud compatibility matrix. The original 2019 tutorial used Java 8 and an older image; do not copy its base-image choice into a current deployment without checking compatibility and support for your chosen Java release.
#1 Best Overall
Enable the server in your application and configure it as a standalone registry:
@SpringBootApplication
@EnableEurekaServer
public class NamingServerApplication {
public static void main(String[] args) {
SpringApplication.run(NamingServerApplication.class, args);
}
}
server.port=8761
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
Spring’s guide demonstrates @EnableEurekaServer and these standalone settings. See Spring’s service registration and discovery guide and the Spring Cloud Netflix reference for configuration details.
Package the application as an executable JAR using your project’s normal Maven or Gradle build. The Dockerfile below assumes the built artifact is copied to app.jar; adjust the source path to match your build output.
FROM eclipse-temurin:17-jre
WORKDIR /app
COPY target/naming-server.jar app.jar
EXPOSE 8761
ENTRYPOINT ["java", "-jar", "/app/app.jar"]
This example shows a Java 17 runtime image, not a universal version recommendation: choose a JRE compatible with the Java version supported by your selected Spring Boot release. For repeatable builds, pin an appropriate image version or digest rather than relying indefinitely on a moving tag.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Build the server image and start a Docker network
-
From the server project directory, build the image:
docker build -f Dockerfile -t eureka-server . -
Create a user-defined network shared by the registry and client:
docker network create spring-demo -
Start the server on that network and publish its dashboard/API port to the host:
docker run -d --name eureka-server --network spring-demo -p 8761:8761 eureka-server
The mapping -p 8761:8761 makes container port 8761 available at host port 8761. Other containers on spring-demo can reach the server at http://eureka-server:8761/eureka without host-port publishing; publish the port when you need browser or host access.
Recommended Free Tools
Rank #3
Configure and package the Spring Boot client
The client project must include the Spring Cloud Netflix Eureka client dependency compatible with its Spring Boot and Spring Cloud versions. Set the registry address to the server’s network name. For example:
server.port=8080
eureka.client.service-url.defaultZone=http://eureka-server:8761/eureka
For a Compose deployment, the host name is typically the registry service key, such as eureka-server. If using a different Docker network or orchestration platform, use the DNS name that platform provides. The relevant requirement is reachability from the client container, not a particular spelling of the hostname.
Create a client Dockerfile, adjusting the JAR path and port for your application:
FROM eclipse-temurin:17-jre
WORKDIR /app
COPY target/eureka-client.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app/app.jar"]
Build and run it on the same network:
docker build -f Dockerfile -t eureka-client .
docker run -d --name eureka-client --network spring-demo -p 8080:8080 eureka-client
If the app uses an environment-specific profile, Spring’s Docker guidance uses the SPRING_PROFILES_ACTIVE environment variable. For example, add -e SPRING_PROFILES_ACTIVE=docker to docker run and put the Docker-specific Eureka URL in that profile’s configuration. See Spring’s Spring Boot with Docker guide.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Verify registration and diagnose connection failures
-
Open http://localhost:8761 on the Docker host to view the registry dashboard.
-
Allow time for the client to start, register, and for the registry view to refresh. Spring’s guide notes that registration and cache refresh can take a short delay.
-
Check the client logs with
docker logs eureka-clientand the server logs withdocker logs eureka-serverif the instance does not appear.
-
Connection refused or failed DNS lookup: Confirm both containers are attached to
spring-demo, the registry is running, and the client URL useseureka-serverrather thanlocalhost.Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsSpecial offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.Best Value
Docker Container Linux Devops Programming Coding T-Shirt- Docker, Docker Swarm, Docker Compose, Programmer, Developer, Coding, Programming, Software Engineer, Code, DevOps, Deploy, Deployment, Kubernetes, Salt, Puppet, Chef, Terraform, Container, AWS, Azure, Cloud, Geek, Funny, Computer, Software, Tech, IT
- Integration, Scrum, Compile, Compilation, Science, Bug, Debug, Python, Linux, Java, Javascript, Scala, Dotnet, Kotlin
- Lightweight, Classic fit, Double-needle sleeve and bottom hem
-
Wrong port: The client-to-server URL must target the server’s container port, normally 8761. The host-side published port matters for access from the host, not for communication over the Docker network.
-
Dashboard opens but client is absent: Check the Eureka client dependency, active Spring profile, configured
defaultZone, and startup logs. Retry after the client has had time to register. -
Host access and container access differ:
http://localhost:8761/eurekacan be appropriate for an application running directly on the host when port 8761 is published. It is not the other container’s address from inside a client container.
What changes for production
A single Eureka server is a convenient local or development setup, not a highly available registry. Eureka keeps registry data in memory; instances send heartbeats to keep registrations current. Multiple peer-aware servers can improve availability, but require configuring peer relationships and deployment networking rather than simply launching identical standalone containers. The Spring Cloud reference also documents IP-address preference and operational security considerations.
Free tools Windows power users keep installed
One-click scans. No signup required.
Do not expose the registry dashboard or API broadly without an appropriate security design. If Spring Security protects the server, account for Eureka’s registration requests and CSRF behavior as described in the Spring Cloud Netflix reference. The reference states that Eureka Server does not support Spring AOT transformations or native images.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

