Windows error: "PWD variable is not set" when running docker-compose up
由于以下错误,我无法在Windows上本地 Boot Hashicup:
WARNING: The PWD variable is not set. Defaulting to a blank string.
Starting docker_compose_db_1 ... done
Starting docker_compose_api_1 ... done
Attaching to docker_compose_db_1, docker_compose_api_1
db_1 |
db_1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
db_1 |
db_1 | 2021-08-10 02:46:22.157 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2021-08-10 02:46:22.157 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2021-08-10 02:46:22.164 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2021-08-10 02:46:22.191 UTC [27] LOG: database system was shut down at 2021-07-22 19:28:07 UTC
db_1 | 2021-08-10 02:46:22.216 UTC [1] LOG: database system is ready to accept connections
api_1 | 2021-08-10T02:46:25.058Z [ERROR] Unable to load config file: error="read /config/config.json: is a directory"
I received the same error from both Command Prompt and PowerShell. Following the advice of this stack overflow thread, I fixed it by replacing ${PWD}
with .
in the docker-compose.yml.
version: '3.7' services: api: image: "hashicorpdemoapp/product-api:v4280cf7" ports: - "19090:9090" volumes: - - ${PWD}/conf.json:/config/config.json + - ./conf.json:/config/config.json
可能值得在说明中提及此修复程序。