-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Received "localhost refused to connect" in browser while all containers were running. Logs showed no error. #1234
-
First Check
- I added a very descriptive title here.
- I used the GitHub search to find a similar question and didn't find it.
- I searched in the documentation/README.
- I already searched in Google "How to do X" and didn't find any information.
- I already read and followed all the tutorial in the docs/README and didn't find an answer.
Commit to Help
- I commit to help with one of those options 👆
Example Code
I wanted to test the template "as is" but failed to get working in my MacOS laptop. Below are the steps I have taken:
1. Git cloned the project to a local folder in my MacOS laptop.
2. Opened the folder using VS Code. Chose "docker-compose.yml" and ran "Compose Up"
3. Confirmed all 4 containers were up and running by running "docker ps"
4. Checked docker-compose logs and spotted no errors
5. Opened "http://localhost" in Chrome. Received an error: This site can’t be reached. Localhost refused to connect."
What did I miss?
Description
Opened browser and typed "http://localhost/". Received an error: This site can’t be reached. Localhost refused to connect.
Operating System
macOS
Operating System Details
Apple M3 Pro, MacOS = Sonoma v14.3.1
Python Version
3.10
Additional Context
docker-compose logs enclosed below
frontend-1 | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
frontend-1 | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
frontend-1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
frontend-1 | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
frontend-1 | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version
backend-1 | Checking for script in /app/prestart.sh
backend-1 | Running script /app/prestart.sh
backend-1 | /app/app/core/config.py:106: UserWarning: The value of POSTGRES_PASSWORD is "changethis", for security, please change it, at least for deployments.
backend-1 | warnings.warn(message, stacklevel=1)
backend-1 | INFO:main:Initializing service
backend-1 | INFO:main:Starting call to 'main.init', this is the 1st time calling it.
backend-1 | INFO:main:Service finished initializing
backend-1 | INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
backend-1 | INFO [alembic.runtime.migration] Will assume transactional DDL.
backend-1 | /app/app/core/config.py:106: UserWarning: The value of POSTGRES_PASSWORD is "changethis", for security, please change it, at least for deployments.
backend-1 | warnings.warn(message, stacklevel=1)
backend-1 | INFO:main:Creating initial data
backend-1 | INFO:main:Initial data created
backend-1 | {"loglevel": "info", "workers": 2, "bind": "0.0.0.0:80", "graceful_timeout": 120, "timeout": 120, "keepalive": 5, "errorlog": "-", "accesslog": "-", "workers_per_core": 1.0, "use_max_workers": null, "host": "0.0.0.0", "port": "80"}
backend-1 | [2024年06月17日 16:40:09 +0000] [1] [INFO] Starting gunicorn 22.0.0
backend-1 | [2024年06月17日 16:40:09 +0000] [1] [INFO] Listening at: http://0.0.0.0:80 (1)
backend-1 | [2024年06月17日 16:40:09 +0000] [1] [INFO] Using worker: uvicorn.workers.UvicornWorker
frontend-1 | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
frontend-1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
backend-1 | [2024年06月17日 16:40:09 +0000] [18] [INFO] Booting worker with pid: 18
frontend-1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
backend-1 | [2024年06月17日 16:40:09 +0000] [20] [INFO] Booting worker with pid: 20
backend-1 | /app/app/core/config.py:106: UserWarning: The value of POSTGRES_PASSWORD is "changethis", for security, please change it, at least for deployments.
backend-1 | warnings.warn(message, stacklevel=1)
frontend-1 | /docker-entrypoint.sh: Configuration complete; ready for start up
backend-1 | /app/app/core/config.py:106: UserWarning: The value of POSTGRES_PASSWORD is "changethis", for security, please change it, at least for deployments.
backend-1 | warnings.warn(message, stacklevel=1)
backend-1 | [2024年06月17日 16:40:18 +0000] [20] [INFO] Started server process [20]
frontend-1 | 2024年06月17日 16:39:50 [notice] 1#1: using the "epoll" event method
frontend-1 | 2024年06月17日 16:39:50 [notice] 1#1: nginx/1.27.0
frontend-1 | 2024年06月17日 16:39:50 [notice] 1#1: built by gcc 12.2.0 (Debian 12.2.0-14)
frontend-1 | 2024年06月17日 16:39:50 [notice] 1#1: OS: Linux 6.5.0-15-generic
frontend-1 | 2024年06月17日 16:39:50 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
frontend-1 | 2024年06月17日 16:39:50 [notice] 1#1: start worker processes
frontend-1 | 2024年06月17日 16:39:50 [notice] 1#1: start worker process 28
frontend-1 | 2024年06月17日 16:39:50 [notice] 1#1: start worker process 29
backend-1 | [2024年06月17日 16:40:18 +0000] [20] [INFO] Waiting for application startup.
backend-1 | [2024年06月17日 16:40:18 +0000] [20] [INFO] Application startup complete.
backend-1 | [2024年06月17日 16:40:18 +0000] [18] [INFO] Started server process [18]
backend-1 | [2024年06月17日 16:40:18 +0000] [18] [INFO] Waiting for application startup.
backend-1 | [2024年06月17日 16:40:18 +0000] [18] [INFO] Application startup complete.
adminer-1 | [Mon Jun 17 16:39:51 2024] PHP 7.4.33 Development Server (http://[::]:8080) started
db-1 |
db-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
db-1 |
db-1 | 2024年06月17日 16:39:50.497 UTC [1] LOG: starting PostgreSQL 12.19 (Debian 12.19-1.pgdg120+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
db-1 | 2024年06月17日 16:39:50.503 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db-1 | 2024年06月17日 16:39:50.503 UTC [1] LOG: listening on IPv6 address "::", port 5432
db-1 | 2024年06月17日 16:39:50.504 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db-1 | 2024年06月17日 16:39:50.509 UTC [26] LOG: database system was shut down at 2024年06月17日 16:39:44 UTC
db-1 | 2024年06月17日 16:39:50.511 UTC [1] LOG: database system is ready to accept connections
Beta Was this translation helpful? Give feedback.
All reactions
The problem is that when you run it with the context menu "compose up" command, it doesn't apply instructions from docker-compose.override.yml
and you containers ports are not mapped to the ports on host machine.
To solve this, run stack with docker compose watch
CLI command as it's described in docs and then access your services using their ports:
Frontend: http://localhost:5173/
Backend: http://localhost:8000/docs
Adminer: http://localhost:8080/
Traefik UI: http://localhost:8090/
MailCatcher: http://localhost:1080/
Replies: 1 comment
-
The problem is that when you run it with the context menu "compose up" command, it doesn't apply instructions from docker-compose.override.yml
and you containers ports are not mapped to the ports on host machine.
To solve this, run stack with docker compose watch
CLI command as it's described in docs and then access your services using their ports:
Frontend: http://localhost:5173/
Backend: http://localhost:8000/docs
Adminer: http://localhost:8080/
Traefik UI: http://localhost:8090/
MailCatcher: http://localhost:1080/
Beta Was this translation helpful? Give feedback.