Getting 404 error after starting Single Bench on docker

Hello all, hello dear dev team,

I’m trying to use docker-compose following this readme.
I’m using the standard configuration for production, just copied env-production file to .env.

When trying to connect to the site, the redirection to HTTPS is working fine, but I get a 404 error. I’m trying to access the website by simply typing localhost in firefox, or the ip address of my server if distant. Both returns 404. Maybe I’m not asking for the right URL?

There is some warning in MariaDb logs:

2020-09-07 15:13:17 0 [Warning] 'user' entry 'root@7c5f92218c23' ignored in --skip-name-resolve mode.
2020-09-07 15:13:17 0 [Warning] 'user' entry '@7c5f92218c23' ignored in --skip-name-resolve mode.
2020-09-07 15:13:17 0 [Warning] 'proxies_priv' entry '@% root@7c5f92218c23' ignored in --skip-name-resolve mode.
2020-09-07 15:13:17 0 [Note] Reading of all Master_info entries succeeded
2020-09-07 15:13:17 0 [Note] Added new Master_info '' to hash table
2020-09-07 15:13:17 0 [Note] mysqld: ready for connections.

And Mari is refusing some connections attempts:

2020-09-07 15:13:22 0 [Note] mysqld: ready for connections.
Version: '10.3.24-MariaDB-1:10.3.24+maria~focal'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
2020-09-07 15:13:27 14 [Warning] Access denied for user 'frappe'@'172.19.0.10' (using password: NO)
2020-09-07 15:13:27 15 [Warning] 'proxies_priv' entry '@% root@7c5f92218c23' ignored in --skip-name-resolve mode.
2020-09-07 15:13:28 16 [Warning] Aborted connection 16 to db: '_22835929e7d52caf' user: '_22835929e7d52caf' host: '172.19.0.10' (Got an error reading communication packets)
2020-09-07 15:14:27 19 [Warning] Access denied for user '_22835929e7d52caf'@'172.19.0.12' (using password: YES)
2020-09-07 15:15:27 20 [Warning] Access denied for user '_22835929e7d52caf'@'172.19.0.12' (using password: YES)
2020-09-07 15:16:27 21 [Warning] Access denied for user '_22835929e7d52caf'@'172.19.0.12' (using password: YES)
2020-09-07 15:17:27 22 [Warning] Access denied for user '_22835929e7d52caf'@'172.19.0.12' (using password: YES)
2020-09-07 15:18:27 23 [Warning] Access denied for user '_22835929e7d52caf'@'172.19.0.12' (using password: YES)
2020-09-07 15:18:48 24 [Warning] 'proxies_priv' entry '@% root@7c5f92218c23' ignored in --skip-name-resolve mode.
2020-09-07 15:18:48 25 [Warning] 'proxies_priv' entry '@% root@7c5f92218c23' ignored in --skip-name-resolve mode.
2020-09-07 15:18:48 26 [Warning] 'proxies_priv' entry '@% root@7c5f92218c23' ignored in --skip-name-resolve mode.
2020-09-07 15:18:48 27 [Warning] 'proxies_priv' entry '@% root@7c5f92218c23' ignored in --skip-name-resolve mode.
2020-09-07 15:18:48 18 [Warning] Aborted connection 18 to db: '_22835929e7d52caf' user: '_22835929e7d52caf' host: '172.19.0.10' (Got an error reading communication packets)

The site_creator seems to be stuck (as my guess is that this container should stop by itself once the site is created. Maybe not)

Installing erpnext...
Updating DocTypes for erpnext       : [========================================] 100%
clearing...
clearing...
clearing...
clearing...
clearing...
clearing...
clearing...
clearing...
Updating customizations for Address
Updating customizations for Contact
*** Scheduler is disabled ***

Nginx seems fine. (socketio ok on 9000)

Am I missing something?

I did a retry and catched the full docker-compose output. Here is the pastebin link:
https://pastebin.com/raw/B1VeXcgG

If you need to try localhost try using env-local instead of env-production.

Thanks Revant.
I just started back from the start, using env-local instead of production with no avail. I am a bit confuse about what exact url I should use.
I get 404 when trying to access localhost.
I get a 403 when trying to access mysite.localhost.

Site name which was used to create the first site need to be used in browser to access it.

Dns based multi tenancy is used in Docker.

I cleaned the docker volumes before making the try with the env-local to clean any trace of env-production. I didn’t changed the default, which for env-localhost is ‘mysite.localhost’.
Do I need to set a DNS or add a line in /etc/hosts on my host system?

docker ps

all containers are working?

Are you inside any VM?

Running directly on the host (archlinux, amd64).
All containers seem to be working without error or abortion.

~/frappe_docker >>> docker ps                                                                                                                                                    ±[develop]
CONTAINER ID        IMAGE                         COMMAND                  CREATED             STATUS              PORTS                                      NAMES
38417c3110b8        frappe/erpnext-worker:edge    "docker-entrypoint.s…"   7 minutes ago       Up 7 minutes        8000/tcp                                   erptest_erpnext-worker-long_1
faf872c77b8d        frappe/erpnext-worker:edge    "docker-entrypoint.s…"   7 minutes ago       Up 7 minutes        8000/tcp                                   erptest_erpnext-worker-short_1
ec47827eca06        frappe/erpnext-worker:edge    "docker-entrypoint.s…"   7 minutes ago       Up 7 minutes        8000/tcp                                   erptest_erpnext-worker-default_1
17dece411019        frappe/erpnext-worker:edge    "docker-entrypoint.s…"   7 minutes ago       Up 7 minutes        8000/tcp                                   erptest_erpnext-schedule_1
b7f817e117db        frappe/frappe-socketio:edge   "docker-entrypoint.s…"   7 minutes ago       Up 7 minutes                                                   erptest_frappe-socketio_1
c71283b7faec        redis:latest                  "docker-entrypoint.s…"   7 minutes ago       Up 7 minutes        6379/tcp                                   erptest_redis-queue_1
f18783cc195f        traefik:v2.2                  "/entrypoint.sh --lo…"   7 minutes ago       Up 7 minutes        0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   erptest_traefik_1
aeba8777e929        mariadb:10.3                  "docker-entrypoint.s…"   7 minutes ago       Up 7 minutes        3306/tcp                                   erptest_mariadb_1
b1261a3b49f5        redis:latest                  "docker-entrypoint.s…"   7 minutes ago       Up 7 minutes        6379/tcp                                   erptest_redis-cache_1
5294a5d869c6        frappe/erpnext-nginx:edge     "/docker-entrypoint.…"   7 minutes ago       Up 7 minutes        80/tcp                                     erptest_erpnext-nginx_1
1ac87c56d0d0        frappe/erpnext-worker:edge    "docker-entrypoint.s…"   7 minutes ago       Up 7 minutes        8000/tcp                                   erptest_erpnext-python_1
507f90e20ce5        redis:latest                  "docker-entrypoint.s…"   7 minutes ago       Up 7 minutes        6379/tcp                                   erptest_redis-socketio_1

Here is the output from docker-compose (without ‘-d’)

Visiting mysite.localhost gives me a 403 forbidden.
Visiting localhost goves me a 404 not found.

I added this line to /etc/hosts:
127.0.0.1 mysite.localhost

No need to restart any service after edditing hosts. Working fine now.

1 Like

Hi tionebrr / revant

I assigned a static IP to VM and added the 192.168.56.108 mysite.example.com and I can access erpnext inside VM on this url, and when I ping mysite.example.com inside VM, it shows the IP address correctly.

However when I try to access it outside the VM from host machine, I get a 404 not found although the IP pings correctly from the host.

Please advise if I’m doing anything wrong? I used env.production!

Best Regards

Got it, it was a DNS cache problem! Clear it resolved the issue and its working perfect! :slight_smile:

2 Likes

I am having exactly the same issue, followed the guide from here.

I am using a single bench local setup,

  • Copied env-local to .env

  • Using docker compose gave my site name as test

However, when I reach to the page using test.localhost I get the 404 not found.

Do I need to add the loopback and site name as mentioned by you to a running nginx container?

Site name should resolve in browser

If you create test then you need to visit http://test

If you create test.localhost then you visit http://test.locahost

Hi,

Thank you for replying back soon. Yes, I did tried with http://test.localhost it still giving me 404.

[Update] We also tried on a mac and had the same issue while replicating the same steps.

Screen GIF

2021-03-26 19-14-05

It works for me and it works on play with docker.

People generally mess up with SITES and SITE_NAME.

if SITES=`test.localhost` then SITE_NAME=test.localhost

Followed the same steps, unfortunately getting this:

image

Other thing is, as soon as I do a docker-compose up -d by following the gif, I get this container frappe_docekr_site_creator_1 to start and then exit:

If I look inside the nginx container and see my etc/hosts file it appears like this:

Please note that the loopback is there, but site name is not getting resolved as test.localhost

/etc/hosts file needs to be updated on your host machine to point to docker vm.

by looking at screenshots you’re either on mac or on windows?

in that case you need to find file that is equivalent of /etc/hosts on linux and edit that.

because there is a vm involved it is not simple as play with docker or docker on linux machine.

I am running windows. I think you are absolutely right, it is the case, as windows doesn’t have a host files.

<pantomime mode>Oh yes it does</pantomime mode>
C:\Windows\System32\drivers\etc\hosts