Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Host DNS record found. Add the following to /etc/hosts:127.0.0.1 project.loc #595

Closed
2 tasks
creactiv opened this issue Jun 20, 2019 · 13 comments
Closed
2 tasks
Assignees

Comments

@creactiv
Copy link

creactiv commented Jun 20, 2019

ISSUE TYPE

  • Bug Report

Checklist

OS / ENVIRONMENT

  1. Host operating system and version: Ubuntu 16.04
  2. (Windows) Native Docker or Docker Toolbox:
  3. Docker version: latest as of today
  4. Docker Compose version: latest as of tody
  5. (Linux) Is SELinux enabled?: no
  6. What git commit hash are you on?: ?

SUMMARY

Not able to add new project to a newly installed devilbox while devilbox or ubuntu does not honor hosts file. hosts file bears the 127.0.0.1 projects entry, but devilbox still claims, i would have to add this entry.

STEPS TO REPRODUCE

Install current Ubuntu 16.04
create user / group devilbox
install docker ce (following devilbox/docker instructions)
install docker compose (following devilbox/docker instructions)
install git
clone devilbox in /opt
cp example-env .env
edit /opt/devilbox/ .env as enclosed
su devilbox
cd /opt/devilbox/data/www
mkdir project
cd project
mkdir htdocs
exit
cd /etc
nano hosts
add: 127.0.0.1 project.loc
save
docker-compose up bind httpd php mysql

browse to intranet scrreen
menue: vhosts:
then i will get this:

No Host DNS record found. Add the following to /etc/hosts:127.0.0.1 project.loc

EXPECTED BEHAVIOUR

it just works as intended and i can add new projects to devilbox and hosts file... :-)

ACTUAL BEHAVIOUR

Whatever i do, and i setup various times and tried different solutions found in world wide web, and all ended up with this error, i couldn't get Ubuntu to do auto dns'ing; i messed up several times and now i am sorta broke :-(

OTHER INFORMATION

Start command

$ docker-compose up bind http php mysql

File and user permissions (Linux & MacOS)

$ id
1001:1001

Hint: when i sudo devilbox and try to start docker-compose up there i will get this:
Couldn'T connect to docker daemon at http+docker://localhost - is it running?
User devilbox IS being in docker group as well.
With root user docker-compose up works

$ ls -la
root@devilbox:/opt/devilbox# ls -al
total 240
drwxr-xr-x 16 root     root      4096 Jun 20 06:10 .
drwxr-xr-x  5 root     root      4096 Jun 20 06:08 ..
drwxr-xr-x  2 root     root      4096 Jun 20 06:07 autostart
drwxr-xr-x  3 devilbox devilbox  4096 Jun 20 06:44 backups
drwxr-xr-x  2 root     root      4096 Jun 20 06:07 bash
drwxr-xr-x  2 devilbox devilbox  4096 Jun 20 06:47 ca
drwxr-xr-x 57 root     root      4096 Jun 20 06:07 cfg
-rw-r--r--  1 root     root      4651 Jun 20 06:07 CHANGELOG.md
drwxr-xr-x  2 root     root      4096 Jun 20 06:07 compose
-rw-r--r--  1 root     root      2770 Jun 20 06:07 CONTRIBUTING.md
drwxr-xr-x  3 root     root      4096 Jun 20 06:07 data
drwxr-xr-x  3 root     root      4096 Jun 20 06:07 .devilbox
-rw-r--r--  1 root     root       743 Jun 20 06:07 docker-compose.override.yml-example
-rw-r--r--  1 root     root     14314 Jun 20 06:07 docker-compose.yml
drwxr-xr-x 20 root     root      4096 Jun 20 06:07 docs
-rw-r--r--  1 root     root      2445 Jun 20 06:07 .editorconfig
-rw-r--r--  1 root     root     16643 Jun 20 06:45 .env
-rw-r--r--  1 root     root     16622 Jun 20 06:07 env-example
drwxr-xr-x  8 root     root      4096 Jun 20 06:07 .git
drwxr-xr-x  3 root     root      4096 Jun 20 06:07 .github
-rw-r--r--  1 root     root      3837 Jun 20 06:07 .gitignore
-rw-r--r--  1 root     root      1064 Jun 20 06:07 LICENSE.md
drwxr-xr-x  4 root     root      4096 Jun 20 06:47 log
drwxr-xr-x  9 root     root      4096 Jun 20 06:44 mod
-rw-r--r--  1 root     root     63099 Jun 20 06:07 README.md
-rw-r--r--  1 root     root        86 Jun 20 06:07 shell.bat
-rwxr-xr-x  1 root     root        59 Jun 20 06:07 shell.sh
drwxr-xr-x  5 root     root      4096 Jun 20 06:07 .tests
-rw-r--r--  1 root     root      9808 Jun 20 06:07 .travis.yml
-rwxr-xr-x  1 root     root      2265 Jun 20 06:07 update-docker.sh
-rw-r--r--  1 root     root      1043 Jun 20 06:07 UPDATING.md
$ ls -la data/www
drwxrwxr-x 3 devilbox devilbox 4096 Jun 20 06:46 project

Queestion: Is it correct to chown the project files & directories to the devilbox user? Usually i'd use www-data for user/group when placing files in webserverdirectory.

$ docker-compose log
root@devilbox:/opt/devilbox/log# docker-compose logs
WARNING: The LOCAL_LISTEN_ADDR variable is not set. Defaulting to a blank string.
WARNING: The DEBUG_COMPOSE_ENTRYPOINT variable is not set. Defaulting to a blank string.
WARNING: The EXTRA_HOSTS variable is not set. Defaulting to a blank string.
WARNING: The BIND_TTL_TIME variable is not set. Defaulting to a blank string.
WARNING: The BIND_REFRESH_TIME variable is not set. Defaulting to a blank string.
WARNING: The BIND_RETRY_TIME variable is not set. Defaulting to a blank string.
WARNING: The BIND_EXPIRY_TIME variable is not set. Defaulting to a blank string.
WARNING: The BIND_MAX_CACHE_TIME variable is not set. Defaulting to a blank string.
WARNING: The BIND_LOG_DNS_QUERIES variable is not set. Defaulting to a blank string.
WARNING: The PHP_SERVER variable is not set. Defaulting to a blank string.
WARNING: The PHP_MODULES_ENABLE variable is not set. Defaulting to a blank string.
WARNING: The PHP_MODULES_DISABLE variable is not set. Defaulting to a blank string.
WARNING: The MYSQL_ROOT_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The DEVILBOX_PATH variable is not set. Defaulting to a blank string.
WARNING: The MOUNT_OPTIONS variable is not set. Defaulting to a blank string.
WARNING: The HOST_PATH_HTTPD_DATADIR variable is not set. Defaulting to a blank string.
WARNING: The HTTPD_SERVER variable is not set. Defaulting to a blank string.
WARNING: The DEVILBOX_UI_ENABLE variable is not set. Defaulting to a blank string.
WARNING: The TLD_SUFFIX variable is not set. Defaulting to a blank string.
WARNING: The HTTPD_DOCROOT_DIR variable is not set. Defaulting to a blank string.
WARNING: The HTTPD_TEMPLATE_DIR variable is not set. Defaulting to a blank string.
WARNING: The HOST_PORT_HTTPD variable is not set. Defaulting to a blank string.
WARNING: The HOST_PORT_HTTPD_SSL variable is not set. Defaulting to a blank string.
WARNING: The MYSQL_SERVER variable is not set. Defaulting to a blank string.
WARNING: The HOST_PORT_MYSQL variable is not set. Defaulting to a blank string.
WARNING: The PGSQL_SERVER variable is not set. Defaulting to a blank string.
WARNING: The PGSQL_ROOT_USER variable is not set. Defaulting to a blank string.
WARNING: The PGSQL_ROOT_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The HOST_PORT_PGSQL variable is not set. Defaulting to a blank string.
WARNING: The REDIS_SERVER variable is not set. Defaulting to a blank string.
WARNING: The HOST_PORT_REDIS variable is not set. Defaulting to a blank string.
WARNING: The MEMCD_SERVER variable is not set. Defaulting to a blank string.
WARNING: The HOST_PORT_MEMCD variable is not set. Defaulting to a blank string.
WARNING: The MONGO_SERVER variable is not set. Defaulting to a blank string.
WARNING: The HOST_PORT_MONGO variable is not set. Defaulting to a blank string.
ERROR: The Compose file './../docker-compose.yml' is invalid because:
services.memcd.ports is invalid: Port ranges don't match in length
services.mongo.ports is invalid: Port ranges don't match in length
services.mysql.ports is invalid: Port ranges don't match in length
services.httpd.ports is invalid: Port ranges don't match in length
services.pgsql.ports is invalid: Port ranges don't match in length
services.redis.ports is invalid: Port ranges don't match in length
services.httpd.ports is invalid: Port ranges don't match in length

So what?

Thanks for pushing me in the right direction ;-)
Best
env.txt

Update: i can ping now project.loc in Ubuntu and get an answer:

root@devilbox:~# ping project..loc
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.036 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.046 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.059 ms
^C
--- localhost ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.036/0.047/0.059/0.009 ms

But still error: No Host DNS record found. Add the following to /etc/hosts/: 127.0.0.1 project.loc :-(

@creactiv creactiv added the bug label Jun 20, 2019
@creactiv creactiv changed the title o Host DNS record found. Add the following to /etc/hosts:127.0.0.1 project.loc No Host DNS record found. Add the following to /etc/hosts:127.0.0.1 project.loc Jun 20, 2019
@stale
Copy link

stale bot commented Aug 20, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the issue:stale This issue has become stale and is marked for auto-close label Aug 20, 2019
@stale stale bot closed this as completed Aug 27, 2019
@cytopia cytopia self-assigned this Nov 17, 2019
@cytopia cytopia removed the issue:stale This issue has become stale and is marked for auto-close label Nov 17, 2019
@cytopia cytopia reopened this Nov 17, 2019
@cytopia
Copy link
Owner

cytopia commented Nov 30, 2019

$ docker-compose log
root@devilbox:/opt/devilbox/log# docker-compose logs
WARNING: The LOCAL_LISTEN_ADDR variable is not set. Defaulting to a blank string.
WARNING: The DEBUG_COMPOSE_ENTRYPOINT variable is not set. Defaulting to a blank string.
WARNING: The EXTRA_HOSTS variable is not set. Defaulting to a blank string.

None of the variables are set, did you copy env-example to .env?

@cytopia
Copy link
Owner

cytopia commented Dec 3, 2019

$ ls -la
root@devilbox:/opt/devilbox# ls -al
total 240
drwxr-xr-x 16 root     root      4096 Jun 20 06:10 .
drwxr-xr-x  5 root     root      4096 Jun 20 06:08 ..
drwxr-xr-x  2 root     root      4096 Jun 20 06:07 autostart
drwxr-xr-x  3 devilbox devilbox  4096 Jun 20 06:44 backups
drwxr-xr-x  2 root     root      4096 Jun 20 06:07 bash
drwxr-xr-x  2 devilbox devilbox  4096 Jun 20 06:47 ca

Also this is mixed root user and mixed devilbox user.

Queestion: Is it correct to chown the project files & directories to the devilbox user? Usually i'd use www-data for user/group when placing files in webserverdirectory.

You don't have to chown anything. Use your local uesrs' uid and gid and add this to the .env and then just start docker-compose up as your normal user.

@creactiv
Copy link
Author

creactiv commented Dec 10, 2019

Well,

i gave it a try with a windows setup, having the same problem here, after i set in the windows host file 127.0.0.1 joomla.loc it still keeps telling me i have to add that to my hosts file ...

And yes, i copied the env-example over to .env, whether it was under linux or with windows. I had a problem first with Docker for Windows, because HyperV kept me from adding port 80, so i set port 80 to 8080... BUT i am using the new edge version of docker for windows (experimental), since the previous one would ask me for login / password to share the discdrive with docker. Since i do not have a password, because i us 2FA; i couldn't continue with installation. Found later the new branch, which will work without samba; therefore might be that part of the problem? Docker for Windows, according to your documentation, handles the uid and gid for itself, but will it still, if it does NOT use samba? See here: docker/for-win#616 (comment)

Thanks for getting back, i almost gave up hope on this one.

Best

Here the versions:
docker 19.03.5 build 633a0ea
docker-compose 1.25.0-rc4 build 8f3c9c58

@cytopia
Copy link
Owner

cytopia commented Dec 31, 2019

Judging by these errors:

WARNING: The HOST_PORT_MONGO variable is not set. Defaulting to a blank string.
ERROR: The Compose file './../docker-compose.yml' is invalid because:
services.memcd.ports is invalid: Port ranges don't match in length

Something is wrong with your setup. It doesn't even show any logs from any Docker container. So I suggest you troubleshoot this first.

@dbrw
Copy link

dbrw commented Mar 10, 2020

I think this might also relevant:

I found error on browser console:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource

@franksierra
Copy link

I'm not sure if this is exactly your problem, but here we go.

I've been having this issue for months (intermittent) I'm on windows using 53 as DNS port and setting the primary DNS as 127.0.0.1 I was wondering why sometimes it work and then suddenly stops.
tried a lookup for one of the domains and seems like windows is defaulting to IPv6 and the bind container isn't answering.
image
image
After disabling IPv6.
image
image

Although the message is correct, its a bit misleading in this case.

@cytopia cytopia removed the invalid label Mar 30, 2020
@alexfd7
Copy link

alexfd7 commented Jun 5, 2020

I'm having the same problem reported.

@andim27
Copy link

andim27 commented Jun 17, 2020

The problem is active if you use vpn. Disconnect vpn service and all will be work

@bbeale
Copy link

bbeale commented Jun 25, 2020

I'm having the same issue and disabling my VPN connection did not fix it.

@ahmedch1
Copy link

You should enter the /etc/hosts of your user not from devilbox container , check if is that is the problem?

@tik9
Copy link

tik9 commented Oct 15, 2020

@ahmedch1, I cannot image a /etc/hosts in the container as this is the sense of docker: Using the base system. And never heard that a user owns /etc/hosts. So I recommend that you push your IT knowledge a bit before sharing your thoughts here .

@cytopia
Copy link
Owner

cytopia commented Nov 12, 2020

This issue already got quite messy.

@creactiv you seem to have several local issues:

  1. Your files and directories have wrong ownership. It should it of your local user/group
  2. docker-compose logs command must be issue from root of project, otherwise it won't yield any useful output
  3. Git commit of Devilbox is missing, so I won't be able to reproduce with your currently checked out version

@dbrw If you have specific issues, please open up a separate bug report


@alexfd7 / @bbeale Please create separate bug reports with your specific details.


@ Everyone:

Also worth to mention: Devilbox is currently at v1.8.1 (#747), which has a lot of bug fixes and additions.
One of them being check-config.sh, which will automatically check against common configuration issues.
Please upgrade to this version and in case this error still persist, open a new bug report with required details and steps to reproduce. This will make it a bit easier to give support on specific cases.

@cytopia cytopia closed this as completed Nov 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants