docker-compose-laravel8_nginx_1 exited with code 127
Closed this issue · 12 comments
docker-compose-laravel8_nginx_1 exited with code 127
Exception in thread Thread-16:
Traceback (most recent call last):
File "docker\api\client.py", line 268, in _raise_for_status
File "requests\models.py", line 941, in raise_for_status
requests.exceptions.HTTPError: 409 Client Error: Conflict for url: http+docker://localnpipe/v1.41/containers/20fb69c6269eae07bc02dcd0358927dda63ada89624?logs=0&stdout=1&stderr=1&stream=1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "threading.py", line 950, in _bootstrap_inner
File "threading.py", line 888, in run
File "compose\cli\log_printer.py", line 224, in watch_events
File "compose\container.py", line 202, in attach_log_stream
File "compose\container.py", line 294, in attach
File "docker\utils\decorators.py", line 19, in wrapped
File "docker\api\container.py", line 62, in attach
File "docker\api\client.py", line 405, in _read_from_socket
File "docker\api\client.py", line 318, in _get_raw_response_socket
File "docker\api\client.py", line 270, in _raise_for_status
File "docker\errors.py", line 19, in create_api_error_from_http_exception
File "requests\models.py", line 881, in json
File "requests\models.py", line 829, in content
File "requests\models.py", line 751, in generate
File "urllib3\response.py", line 575, in stream
File "urllib3\response.py", line 518, in read
File "http\client.py", line 458, in read
File "http\client.py", line 502, in readinto
File "docker\transport\npipesocket.py", line 211, in readinto
File "docker\transport\npipesocket.py", line 20, in wrapped
RuntimeError: Can not reuse socket after connection was closed.
Can you please provide details of your docker-compose.yml
file, and Laravel version that you are attempting to run.
this is the docker compose
try to run laravel 8
version: "3.8"
services:
redis:
image: redis:6.0-alpine
expose:
- "6379"
db:
image: mysql:8
ports:
- "3307:3306"
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: laravel
volumes:
- db-data:/var/lib/mysql
nginx:
environment:
VIRTUAL_HOST: testing.local
restart: "no"
ports:
- "8000:80"
volumes:
- ./docker/nginx.conf:/etc/nginx/nginx.conf:ro
- ./public:/app/public:ro
php:
build:
target: dev
restart: "no"
ports:
- "8080:80"
depends_on:
- composer
- redis
- db
volumes:
- ./:/app
- ./docker/www.conf:/usr/local/etc/php-fpm.d/www.conf:ro
node:
image: node:12-alpine
working_dir: /app
volumes:
- ./:/app
command: sh -c "npm install && npm run watch"
composer:
image: composer:1.10
working_dir: /app
environment:
SSH_AUTH_SOCK: /ssh-auth.sock
volumes:
- ./:/app
# - "$SSH_AUTH_SOCK:/ssh-auth.sock"
- /etc/passwd:/etc/passwd:ro
- /etc/group:/etc/group:ro
command: composer install --ignore-platform-reqs --no-scripts
volumes:
db-data:
my pc os is windows 10,
nginx.Dockerfile
FROM nginx:1.19-alpine
WORKDIR /app/public
COPY ./docker/nginx.conf /etc/nginx/nginx.conf
COPY ./public/* /app/public/
COPY ./docker/resolve-localdomain.sh /docker-entrypoint.d/30-resolve-localdomain.sh
RUN chmod +x /docker-entrypoint.d/30-resolve-localdomain.sh
That seems to be it. Do you have the resolve-localdomain.sh
in the docker folder?
Can you try removing the resolve-localdomain.sh
script from nginx.Dockerfile
, lines https://github.com/Daursu/laradocker/blob/master/docker/nginx.Dockerfile#L7-L9 ?
after commenting these two lines i am able to run in http://localhost:8000/ at least
another issue m facing now is , any change i make in my vue file its not reflecting in http://localhost:8000/
Did you setup VueJS yourself? VueJS is not part of this laradocker bundle. The docker compose file simply runs npm run watch
on startup. Are there any errors in the browser console that indicate vuejs trying to reload files?
If webpack HMR bundle is trying to communicate on an alternative port you should see it as a failed XHR request, and you will need to forward that port from the docker container to your laptop.
O ok got it i need to forward the port , it i'll try that.
as a workaround, as the volume is mounted to whole folder, i was just running npm run watch
myself and the HMR is working.
@Daursu forward port for this right ?
Yes, the node
container is the one that requires port forwarding
thanks @Daursu