L
L
lolrofl012020-07-20 14:14:55
Docker
lolrofl01, 2020-07-20 14:14:55

Why does docker on wsl start but localhost:8080 doesn't respond?

Installed docker on wsl, because I work with windows all the time. Added my config:

docker-compose.yml

version: "3.1"
services:

    mysql:
      image: mysql:8.0
      container_name: my-mysql
      working_dir: /app
      volumes:
        - .:/app
      environment:
        - MYSQL_ROOT_PASSWORD=secret
        - MYSQL_DATABASE=sm
        - MYSQL_USER=sly
        - MYSQL_PASSWORD=secret
      ports:
        - "8082:3306"

    webserver:
      image: nginx:alpine
      container_name: my-webserver
      working_dir: /app
      volumes:
          - .:/app
          - ./docker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
      ports:
       - "8080:80"

    php-fpm:
      build: docker/php-fpm
      container_name: my-php-fpm
      working_dir: /app
      volumes:
        - .:/app
        - ./docker/php-fpm/php-ini-overrides.ini:/etc/php/7.4/fpm/conf.d/99-overrides.ini



nginx.conf

server {
    listen 80 default;

    client_max_body_size 108M;

    access_log /var/log/nginx/app.access.log;
    error_log /var/log/nginx/app.error.log;


    root /app/public;
    index index.php;

    if (!-e $request_filename) {
        rewrite ^.*$ /index.php last;
    }

    location ~ \.php$ {
        fastcgi_pass php-fpm:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PHP_VALUE "error_log=/var/log/nginx/app_php_errors.log";
        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;
        include fastcgi_params;
    }
    
}



dockerfile

FROM phpdockerio/php74-fpm:latest
WORKDIR "/app"

# Fix debconf warnings upon build
ARG DEBIAN_FRONTEND=noninteractive

# Install selected extensions and other stuff
RUN apt-get update \
&& apt-get -y --no-install-recommends install php7.4-mysql php-xdebug \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

# Install git
RUN apt-get update \
&& apt-get -y install git \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*


On localhost:8080 does not come. CMD says:
ping localhost:8080 Ping
failed to locate host localhost:8080.
Check the hostname and try again.

At the same time, the status of running in the docker desktop is everywhere. Those. Everything is okay. There are no errors. What can be wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-07-20
@q2digger

just not ping localhost:8080
but
curl -v http://localhost:8080
in Windows you may not have it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question