更新时间:2023-10-15 14:46:40
您的应用正在尝试使用名称jhipster-registry
作为主机名来查找注册表.为此,您需要将注册表和应用添加到Docker网络.
Your app is trying to locate the registry using the name jhipster-registry
as a host name. To be able to do that, you need to have your registry and app added to a docker network.
首先使用以下方法创建网络:
First create the network using:
docker network create my-network
通过给容器命名并将其添加到网络创建中来更新撰写文件:
Update the compose file by giving the container a name and adding it to the network create:
version: '2'
services:
jhipster-registry:
image: jhipster/jhipster-registry:v3.1.0
volumes:
- ./central-server-config:/central-config
# When run with the "dev" Spring profile, the JHipster Registry will
# read the config from the local filesystem (central-server-config directory)
# When run with the "prod" Spring profile, it will read the configuration from a Git repository
# See https://jhipster.github.io/microservices-architecture/#registry_app_configuration
environment:
- SPRING_PROFILES_ACTIVE=dev,native
- SECURITY_USER_PASSWORD=admin
- SPRING_CLOUD_CONFIG_SERVER_NATIVE_SEARCH_LOCATIONS=file:./central-config/localhost-config/
# - GIT_URI=https://github.com/jhipster/jhipster-registry/
# - GIT_SEARCH_PATHS=central-config
ports:
- 8761:8761
networks:
- my-network
container_name: jhipster-registry
networks:
my-network:
external: true
运行应用程序时,请指定网络:
When running your application specify the network:
docker run --network=my-network ...
现在,您的应用程序可以使用jhipster-registry
作为主机名与注册表进行通信.
Now your application can communicate with the registry using jhipster-registry
as a hostname.