K
K
Kirill Kontorovich2019-12-29 19:47:09
PHP
Kirill Kontorovich, 2019-12-29 19:47:09

How to fix error with php + docker?

I am running a yii2 project in docker. The problem is that when opening any external resource, through fopen, curl and so on, I catch the error:

fopen(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution docker-compose

version: '3.5'
services:
  nginx:
    container_name: ${COMPOSE_PROJECT_NAME}_nginx
    image: nginx:latest
    restart: always
    ports:
      - "${NGINX_PORT}:80"
      - "${NGINX_PORT_SSL}:443"
    volumes:
      - ./docker/nginx/${NGINX_HOST}.conf:/etc/nginx/conf.d/default.conf
      - .:/var/www/${COMPOSE_PROJECT_NAME}
    links:
      - php
  php:
    container_name: ${COMPOSE_PROJECT_NAME}_php
    build: ./docker/php
    restart: always
    volumes:
      - .:/var/www/${COMPOSE_PROJECT_NAME}
    links:
      - postgres
  postgres:
    container_name: ${COMPOSE_PROJECT_NAME}_postgres
    image: postgres:latest
    restart: always
    ports:
      - "${POSTGRES_PORT}:5432"
    volumes:
      - ./docker/postgres:/var/lib/postgresql/data
      - ./docker/dump:/tmp/dump
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_DB: ${DB_DATABASE}
      PGDATA: ${POSTGRES_DATA}
  front:
    container_name: ${COMPOSE_PROJECT_NAME}_front
    build: ./docker/front
    restart: always
    volumes:
      - .:/var/www/${COMPOSE_PROJECT_NAME}
    environment:
      NODE_ENV: ${NGINX_HOST}
      DEBUG: ${APP_DEBUG}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2019-12-29
@ishimitsu

It?
https://stackoverflow.com/questions/24151129/netwo...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question