Docker Community Forums

Share and learn in the Docker community.

VSCODE needs PHP server access, PHP is in a separate container--ACCESS?

I have WSL2 running on Windows 10. I am using Ubuntu 20.04 installed in the WLS2. I have docker for windows and several containers. One is laravelsail/php80-composer. It has PHP 8.0 installed.

When I work in VSCODE, some of the extensions need access to a PHP server. Is there anyway to link to the PHP server in the container so I don’t have to install PHP on the VisualStudio Code host?

For context, I’m trying to keep just the code on the host computer and have PHP, Composer, nginx/apache, mysql, redis, etc all in seperate containers. Was trying not to have a bunch of PHP versions and Composer versions mucking up the host installation. Am I being to ambitious with containerization?


FROM laravelsail/php80-composer

ADD ./php/www.conf /usr/local/etc/php-fpm.d/www.conf

RUN addgroup -group laravel 
RUN adduser -GROUP laravel -system 
RUN mkdir -p /var/www/html

RUN chown laravel:laravel /var/www/html

WORKDIR /var/www/html




        context: .

        dockerfile: php.dockerfile

    container_name: php


        - ./src:/var/www/html:delegated


        - laravel

Sorry the editing is so bad. This is my first post and I have no idea how to put code in the message so it’s formatted correctly.