skip to Main Content

I am using the Docker Engine running on WSL2 which is running on Windows 10 computer. My goal is to create a service using the Docker-compose that uses the php:fpm image and install the mysqli extension to it. Here is my docker-compose.yaml

version: "3"

services:
  nginx:
    image: "nginx"
    restart: 'always'
    ports:
      - '3030:80'
    volumes:
      - ./src:/src
      - ./config/site.conf:/etc/nginx/conf.d/default.conf
    networks:
        - code-network
  php:
    build:
      context: .
      dockerfile: Dockerfile
    image: php:fpm
    volumes:
        - ./src:/src
    networks:
        - code-network
  mariadb:
    image: "mariadb:10.3.24"
    restart: 'always'
    volumes:
      - "/var/lib/mysql/data:/data"
      - "/var/lib/mysql/logs:/logs"
      - /var/docker/mariadb/conf:/etc/mysql
    environment:
      MYSQL_ROOT_PASSWORD: "root"
      MYSQL_DATABASE: "T05CNCitk2020@"
      MYSQL_USER: "user"
      MYSQL_PASSWORD: "Heslo123"
    networks:
        - code-network

networks:
    code-network:
        driver: bridge

And here is my Dockerfile:

FROM php:fpm

RUN docker-php-ext-install mysqli

When I run the command docker-compose up --build which forces the container to rebuild. I ran into the following problem:

Building php
unable to prepare context: path "\\?\\\wsl$\Ubuntu-20.04\home\vendasky\Projects\sql-gui" not found
ERROR: Service 'php' failed to build : Build failed

I do not see the reason why the path should be wrong when all the files are located in the Linux subsystem. Any hints, how to solve this problem?

2

Answers


  1. are you runnning this with docker desktop for windows?

    If thats the case try enabling the Docker Compose V2 option under the experimental settings. This should fix your problem.

    Login or Signup to reply.
  2. Docker is unable to find the path to that project, map your ubuntu correctly so it can easily locate the project, that should fix your issue.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search