iyaki
Repos
13
Followers
9
Following
14

Extremly minimal PHP framework

0
0

Example implementation of the swagger petstore with TheNoFramework

0
0

Events

issue comment
devcontainer.json features break build when used with latest docker-compose syntax

Little update. I notioced that if devcontainer cli is configured to use the docker compose plugin (executing devcontainer up --workspace-folder . --docker-compose-path 'docker compose') instead of the docker-compose script (that is used by defult) the features works as expected.

Created at 2 weeks ago
issue comment
devcontainer.json features break build when used with latest docker-compose syntax

My "original" Dockerfile:

# syntax=docker/dockerfile:1

FROM composer:2 as composer-dev

FROM php:8.0-cli as php-dev

COPY --from=composer-dev /usr/bin/composer /usr/bin/composer

RUN curl --location --output /usr/local/bin/install-php-extensions https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions \
  && mkdir -p /var/lib/php/session \
  && chmod -R 0777 /var/lib/php/session \
  && chmod +x /usr/local/bin/install-php-extensions \
  && install-php-extensions pdo mysqli pdo_mysql gd soap intl curl dom mbstring iconv simplexml zip sockets

Dockerfile-with-features:


ARG _DEV_CONTAINERS_BASE_IMAGE=placeholder

FROM composer:2 as composer-dev

FROM php:8.0-cli as php-dev
# copy the Composer PHAR from the official Composer image into the PHP image
COPY --from=composer-dev /usr/bin/composer /usr/bin/composer

RUN curl --location --output /usr/local/bin/install-php-extensions https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions \
  && mkdir -p /var/lib/php/session \
  && chmod -R 0777 /var/lib/php/session \
  && chmod +x /usr/local/bin/install-php-extensions \
  && install-php-extensions pdo mysqli pdo_mysql gd soap intl curl dom mbstring iconv simplexml zip sockets





FROM dev_container_feature_content_temp as dev_containers_feature_content_source

FROM $_DEV_CONTAINERS_BASE_IMAGE AS dev_containers_target_stage

USER root

COPY --from=dev_containers_feature_content_source /tmp/build-features/ /tmp/build-features/



RUN cd /tmp/build-features/git_1 \
&& set -a \
&& . ./devcontainer-features.env \
&& set +a \
&& chmod +x ./install.sh \
&& ./install.sh







ARG _DEV_CONTAINERS_IMAGE_USER=root
USER $_DEV_CONTAINERS_IMAGE_USER
Created at 2 weeks ago
opened issue
devcontainer.json features break build when used with latest docker-compose syntax

I'm using a devcontainer relying on a docker-compose.yml, this is an extract of the docker-compose.yml:

version: "3.7"
services:

  php:
    build:
        context: ./Application
        dockerfile: deploy/Dockerfile
        target: php-dev
    volumes:
      - ./Application/deploy/php.d/99-ini-overrides.ini:/usr/local/etc/php/conf.d/99-ini-overrides.ini


If I enable any feature in my devcontainer.json (e.g. git)

This is the devcontainer.json with the feature enabled:

{
    "name": "Existing Docker Compose (Extend)",
    "dockerComposeFile": [
        "../docker-compose.yml"
    ],

    "service": "php",

    "workspaceFolder": "/workspace",

    "features": {
        "git": "latest"
      }
}

When I enable any feature in the devcontainer.js I receive this error when running devcontainer up --workspace-folder .

[3355 ms] Start: Run: docker-compose --project-name development-environment -f /home/iyaki/Proyectos/MyProject/Development-Environment/docker-compose.yml -f /home/iyaki/Proyectos/MyProject/Development-Environment/.devcontainer/docker-compose.yml -f /tmp/docker-compose/docker-compose.devcontainer.build-1663619122912.yml build
ERROR: Version mismatch: file /home/iyaki/Proyectos/MyProject/Development-Environment/docker-compose.yml specifies version 3.7 but extension file /tmp/docker-compose/docker-compose.devcontainer.build-1663619122912.yml uses version 1
[3596 ms] Stop (241 ms): Run: docker-compose --project-name development-environment -f /home/iyaki/Proyectos/MyProject/Development-Environment/docker-compose.yml -f /home/iyaki/Proyectos/MyProject/Development-Environment/.devcontainer/docker-compose.yml -f /tmp/docker-compose/docker-compose.devcontainer.build-1663619122912.yml build
Error: Command failed: docker-compose --project-name development-environment -f /home/iyaki/Proyectos/MyProject/Development-Environment/docker-compose.yml -f /home/iyaki/Proyectos/MyProject/Development-Environment/.devcontainer/docker-compose.yml -f /tmp/docker-compose/docker-compose.devcontainer.build-1663619122912.yml build
    at buildAndExtendDockerCompose (/home/iyaki/node_modules/@devcontainers/cli/dist/spec-node/dockerCompose.js:263:66)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async startContainer (/home/iyaki/node_modules/@devcontainers/cli/dist/spec-node/dockerCompose.js:355:77)
    at async _openDockerComposeDevContainer (/home/iyaki/node_modules/@devcontainers/cli/dist/spec-node/dockerCompose.js:75:25)
    at async resolveWithLocalFolder (/home/iyaki/node_modules/@devcontainers/cli/dist/spec-node/configContainer.js:80:18)
    at async launch (/home/iyaki/node_modules/@devcontainers/cli/dist/spec-node/devContainers.js:42:20)
    at async doProvision (/home/iyaki/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:202:24)
    at async provision (/home/iyaki/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:187:20)
{"outcome":"error","message":"Command failed: docker-compose --project-name development-environment -f /home/iyaki/Proyectos/MyProject/Development-Environment/docker-compose.yml -f /home/iyaki/Proyectos/MyProject/Development-Environment/.devcontainer/docker-compose.yml -f /tmp/docker-compose/docker-compose.devcontainer.build-1663619122912.yml build","description":"An error occurred building the Docker Compose images."}

This is the content of the autogenerated doker-compose,yaml at /tmp/docker-compose/docker-compose.devcontainer.build-1663619122912.yml:

services:
  php:
    build:
      dockerfile: /tmp/vsch-iyaki/container-features/0.14.2-1663619120444/Dockerfile-with-features
      target: dev_containers_target_stage
      args:
        - BUILDKIT_INLINE_CACHE=1
        - _DEV_CONTAINERS_BASE_IMAGE=php-dev
        - _DEV_CONTAINERS_IMAGE_USER=root
        - _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp

If I remove the feature property in the devontainer.js the CLI does not add the -f /tmp/docker-compose/docker-compose.devcontainer.build-1663619122912.yml argument and the container starts and runs without any troubles.

I tried launching the container from inside Visual Studio Code with the Remote Containers extensions, but the behavior is the same.

I have not enough experiece to debug the CLI by myself but if I can help in any other way, providing more info, traces, or even a repository reproducing the bug please tell me.

Created at 2 weeks ago
Created at 2 months ago