Answer a question

I recieved a project and I need to make some changes to the code, the guy who was working on it was using Docker (a tool that I never used..), so now I am trying to "emulate" it but here it what happens :

Inside the root of the project I run the command : docker-compose up

Then, in Docker Desktop, under the container, I see every process running (beside webpacker_1), then I click on app, then "Open in browser" and then I have this error from Chrome :

This page isn’t working
0.0.0.0 didn’t send any data.
ERR_EMPTY_RESPONSE

and inside the 'console' of app insisde Docker Desktop

[21-Feb-2022 12:26:08] NOTICE: fpm is running, pid 1

[21-Feb-2022 12:26:08] NOTICE: ready to handle connections

docker-compose.yml

version: "3"

services:
  app:
    build: docker/php
    ports:
      - 9111:9111
      - 8080:80
    volumes:
      - ./:/app
    depends_on:
      - db
      - mailcatcher
      - elasticsearch
    environment:
      XDEBUG_CONFIG: "idekey=PHPSTORM remote_enable=On remote_connect_back=On"
  webpacker:
    image: node:9-alpine
    working_dir: /app
    volumes:
      - ./:/app
    command: /bin/true
  nginx:
    platform: linux/x86_64
    image: nginx:1.12-alpine
    ports:
      - 8082:80
    volumes:
      - ./:/app
      - ./docker/nginx/vhost.conf:/etc/nginx/conf.d/vhost.conf
    depends_on:
      - app
  mailcatcher:
    image: schickling/mailcatcher:latest
    ports:
      - 1080:1080
  db:
    platform: linux/x86_64
    image: mysql:8
    volumes:
      - /var/lib/mysql
      - ./docker/mysql/config.cnf:/etc/mysql/conf.d/config.cnf
    ports:
      - 33060:3306
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: yii2-starter-kit
      MYSQL_USER: ysk_dbu
      MYSQL_PASSWORD: ysk_pass
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    links:
      - db:db
    ports:
      - 7000:80
    environment:
      PMA_HOST: db
      MYSQL_USER: ysk_dbu
      MYSQL_PASSWORD: ysk_pass
      MYSQL_ROOT_PASSWORD: root
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:5.5.3
    container_name: warehouse-elasticsearch
    environment:
      - discovery.type=single-node
      - http.port=9200
      - http.cors.enabled=true
      - http.cors.allow-origin=*
      - http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization
      - http.cors.allow-credentials=true
      - xpack.security.enabled=false
      - bootstrap.memory_lock=true
      - 'ES_JAVA_OPTS=-Xms512m -Xmx512m'
    ports:
      - '9200:9200'
      - '9300:9300'
    volumes:
      - ./data/elastic:/usr/share/elasticsearch/data
  dejavu:
    image: appbaseio/dejavu:3.2.3
    container_name: dejavu
    ports:
      - '1358:1358'
    links:
      - elasticsearch
  elastichq:
    image: elastichq/elasticsearch-hq
    environment:
      - "HQ_DEFAULT_URL=http://elasticsearch:9200"
    ports:
      - "5000:5000"

docker/php/Dockerfile

FROM php:7.1-fpm

# Install modules
RUN apt-get update && apt-get install -y \
        libfreetype6-dev \
        supervisor \
        libjpeg62-turbo-dev \
        libmcrypt-dev \
        libpng-dev \
        libicu-dev \
        wget \
        git \
            --no-install-recommends

RUN docker-php-ext-install mcrypt zip intl mbstring pdo_mysql exif \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install gd

RUN pecl install -o -f xdebug-2.6.0beta1 \
    && rm -rf /tmp/pear

COPY ./install-composer.sh /
COPY ./php.ini /usr/local/etc/php/
COPY ./www.conf /usr/local/etc/php/
COPY ./supervisord.conf /etc/supervisor/supervisord.conf
COPY ./supervisor /etc/supervisor/conf.d

RUN apt-get purge -y g++ \
    && apt-get autoremove -y \
    && rm -r /var/lib/apt/lists/* \
    && rm -rf /tmp/* \
    && sh /install-composer.sh \
    && rm /install-composer.sh

RUN usermod -u 1000 www-data

VOLUME /root/.composer
WORKDIR /app

CMD ["php-fpm"]

If you need anything else please tell me, thanks !

Answers

The problem was that I was trying to access the app from the browser, instead I tried accessing the ngix from the browser and it worked

Logo

云原生社区为您提供最前沿的新闻资讯和知识内容

更多推荐