Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error during docker compose: build path either does not exist, is not accessible, or is not a valid URL

phpstorm swears at parsing the docker-compose.yml file:

Error while parsing "/home/victor/PhpstormProjects/cpalife-back/docker-compose.yml"
Process `docker-compose config` failed. build path /home/victor/PhpstormProjects/tickets/docker/php-fpm either does not exist, is not accessible, or is not a valid URL.
version: '3.4'

networks:
  ppticket:
    ipam:
      config:
        - subnet: 172.46.0.0/16

services:
  nginx:
    image: nginx:1.14.0-alpine
    container_name: tt_nginx
    ports:
      - 80:80
      - 443:443
    networks:
      ppticket:
        ipv4_address: 172.46.0.2
    volumes:
      - ./:/var/www
      - ./docker/logs/nginx:/var/log/nginx
      - ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./docker/nginx/default.conf:/etc/nginx/conf.d/config.template:ro
    environment:
      NGINX_HOST: ${BASE_DOMAIN}
    cap_add:
      - SYS_TIME
    command: /bin/sh -c "envsubst '$$NGINX_HOST' < /etc/nginx/conf.d/config.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"

  #PHP
  php:
    build: ./docker/php
    container_name: cpa_php
    expose:
      - 9000
    networks:
      ppticket:
        ipv4_address: 172.46.0.3
    volumes:
      - ./:/var/www
      - ./docker/logs/php:/var/log/php
      - ./docker/php/php.ini:/etc/php/php.ini:ro
      - ./docker/php/www.conf:/usr/local/etc/php-fpm.d/www.conf:ro
    environment:
      XDEBUG_CONFIG: "remote_host=172.46.0.0 remote_enable=1"
      PHP_IDE_CONFIG: "serverName=Docker"
    cap_add:
      - SYS_TIME
    depends_on:
      - mysql
    restart: always
  #MYSQL
  mysql:
    image: percona:5.7.23
    container_name: cpa_mysql
    volumes:
      - ./docker/data/mysql:/var/lib/mysql
      - ./docker/logs/mysql:/var/log/mysql
    networks:
      ppticket:
        ipv4_address: 172.46.0.4
    expose:
      - 3306
    ports:
      - 127.0.0.1:3306:3306
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_DATABASE: ${MYSQL_DB}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
    cap_add:
      - SYS_TIME
    restart: always
    command: "mysqld --collation-server=utf8_general_ci --character-set-server=utf8 --max_allowed_packet=3M"
like image 615
user301217 Avatar asked Aug 20 '19 09:08

user301217


2 Answers

This problem occours when the directory of the docker-compose.yml is different from the directory of the docker file.

  1. Make sure the path given in doker-compose.yml is inside the same directory

if you are on linux based system check the path by " pwd"

move the directory

"mv /path/to/source /path/to/dest"

like image 103
Hari Gandham Avatar answered Oct 22 '22 09:10

Hari Gandham


I build docker images on windows. To solve the issue you will use the Dockerfile specified in the build path of your Docker-compose.yml. So check the directory of your Dockerfile. Hope this helps enter image description here

like image 35
raphaeljuwe Avatar answered Oct 22 '22 08:10

raphaeljuwe