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

New manual install get nginx 502 error #116

Closed
mediclab opened this issue Jan 16, 2019 · 9 comments
Closed

New manual install get nginx 502 error #116

mediclab opened this issue Jan 16, 2019 · 9 comments

Comments

@mediclab
Copy link

mediclab commented Jan 16, 2019

After new magento 2.2.6 install with sample data, nginx get 502 error

app_1            | 2019/01/16 08:01:11 [info] 8#8: *1 client closed connection while waiting for request, client: 172.19.0.1, server: 0.0.0.0:8443
app_1            | 2019/01/16 08:01:11 [info] 7#7: *2 client closed connection while waiting for request, client: 172.19.0.1, server: 0.0.0.0:8443
app_1            | 2019/01/16 08:01:11 [crit] 8#8: *3 connect() to unix:/sock/docker.sock failed (2: No such file or directory) while connecting to upstream, client: 172.19.0.1, server: , request: "GET /admin/ HTTP/1.1", upstream: "fastcgi://unix:/sock/docker.sock:", host: "magento.local"
app_1            | 172.19.0.1 - - [16/Jan/2019:08:01:11 +0000] "GET /admin/ HTTP/1.1" 502 576 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/71.0.3578.98 Chrome/71.0.3578.98 Safari/537.36" "-"
app_1            | 2019/01/16 08:01:11 [crit] 8#8: *3 connect() to unix:/sock/docker.sock failed (2: No such file or directory) while connecting to upstream, client: 172.19.0.1, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://unix:/sock/docker.sock:", host: "magento.local", referrer: "https://magento.local/admin/"
app_1            | 172.19.0.1 - - [16/Jan/2019:08:01:11 +0000] "GET /favicon.ico HTTP/1.1" 502 576 "https://magento.local/admin/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/71.0.3578.98 Chrome/71.0.3578.98 Safari/537.36" "-"
medic84-note:~/Documents/Work/magento-docker$ sudo docker-compose exec phpfpm ls /sock -la
total 8
drwxr-xr-x 2 app  app  4096 Dec 24 15:02 .
drwxr-xr-x 1 root root 4096 Jan 16 08:21 ..
@mark-gene
Copy link

I also have repeated this issue when trying to do a manual install

@docker77
Copy link

Same to me. Any workarounds?

@markshust
Copy link
Owner

are you installing to a directory in which you previously had an old docker-magento install? if so i believe you need to remove the associated data volumes because of the old config being run against them. you can manually remove them or run bin/remove, then try reinstalling again.

@mediclab
Copy link
Author

are you installing to a directory in which you previously had an old docker-magento install? if so i believe you need to remove the associated data volumes because of the old config being run against them. you can manually remove them or run bin/remove, then try reinstalling again.

No. It's a really new install. And after error, re-install app with bin/remove also not working.

@mark-gene
Copy link

mark-gene commented Jan 28, 2019

I think it is something to do with a default php-fpm config file which overrides and sets php-fpm to listen on port 9000. I believe the file is zz-docker.conf

docker-library/php#241

^May not be the full reason, but if I rebuilt the image locally using your Dockerfile and added a line to remove this I then got it working as expected.

@markshust
Copy link
Owner

i'm unable to replicate. i tried an automated install and a manual install, and both successfully installed.

i want to verify that you are completely purging your system before trying again

there should be nothing returned as a result for:

containers: docker ps -a
images: docker images
volumes: docker volume ls

note that bin/remove will remove all associated containers for the project, and bin/removevolumes will remove all associated volumes. you need to run both to completely purge a project. perhaps something is laying around.

fyi i made no changes to port 9000 or anything wtih zz-docker.conf. appears to work as is.

@markshust
Copy link
Owner

markshust commented Jan 28, 2019

also, i want to verify everyone is using the exact steps laid out at https://github.com/markoshust/docker-magento#quick-setup

these are the steps i'm taking to replicate a successful install (either automated or manual, both successfully installed for me).

@lucbard
Copy link

lucbard commented Jul 17, 2019

I have the same issue trying to manually install Magento CE 2.2.6 here is my setup before starting the install:
docker container ls -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
docker images -a REPOSITORY TAG IMAGE ID CREATED SIZE
docker volume ls DRIVER VOLUME NAME

Then here are the commands that I ran for manual setup:
curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash -s -- magento-2

bin/download 2.2.6

I had to change the docker.composer.yml this :
image: markoshust/magento-php:7.1-fpm-0

because it failed to find the 7.2-fpm-3 package and even with 7.2-fpm-2 I had a bunch of errors that it did not meet the PHP version requirements.

bin/setup mydomain.dev

Other then that the setup goes very well with no errors. My only problem is that I am getting the 502 Bad Gateway error when trying to reach the site.

The bin/magento command works fine BTW.

I ran the command docker logs -f ea2891582dfd (this is the nginx container id)

And this is what I see:

172.19.0.1 - - [17/Jul/2019:21:26:54 +0000] "GET / HTTP/1.1" 502 174 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Safari/605.1.15" "-"
2019/07/17 21:26:54 [crit] 7#7: *6 connect() to unix:/sock/docker.sock failed (2: No such file or directory) while connecting to upstream, client: 172.19.0.1, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/sock/docker.sock:", host: "mydomain.dev"
2019/07/17 21:27:30 [info] 7#7: *6 client 172.19.0.1 closed keepalive connection

Any help would be appreciated.

Thanks,
Luc

@vernard
Copy link

vernard commented Sep 29, 2021

This is also happening to me, and I found a solution.

I containerized a whole Magento installation inside a custom image and it's loading all of the files upon docker-compose up -d.

I found that there's an error when I initially compose my container which says UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)

But when I run docker-compose up -d again, it just goes up fine.

I'm guessing it is related to that.

So what I did is extended the timeout by adding the following environment variables:

export DOCKER_CLIENT_TIMEOUT=120
export COMPOSE_HTTP_TIMEOUT=120

And after that, I refreshed my containers including the volume.

I ran this command: docker-compose down && docker volume prune -f && docker-compose up -d (BE CAREFUL, THIS REMOVES YOUR VOLUME AND YOU'LL LOSE ALL DATA IN YOUR CONTAINER)

EDIT:

Alternatively, I created an .env file (same directory as the docker-compose.yml file) and put these as variables:

DOCKER_CLIENT_TIMEOUT=120
COMPOSE_HTTP_TIMEOUT=120

That way, I don't have to re-set it everytime it fails.

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

6 participants