Docker-compose file version

Hello i’m planning to build a website for a friend!
And in this project, i need php/mysql

I have already built the docker-compose and a DockerFile for commands

docker-compose :
version : ‘3.8’

services:
php:
image: php:8.2-apache
container-name: php
ports:
- 8000:80
volumes:
- ./php:/var/www/html
build:
context: .
dockerfile: DockerFile />

And the DockerFile :

FROM php:8.2-apache

RUN apt-get update && apt-get upgrade -y

RUN docker-php-ext-install mysqli pdo pdo_mysql && docker-php-ext-enable mysqli pdo_mysql

EXPOSE 80

It’s not pulling so i guess my file version isn’t 3.8

But can’t find my Docker-compose version and 3.8 isn’t for Docker version 24.0.6
It’s not displayed in the compatibilty matrix !

Anyone can help me ? ^^

This is the error :

validating C:\Users.…\docker-compose.yml: services.php Additional property container-name is not allowed

There is no compose file version anymore. Docker Compose v2 ignores it and the supported syntax depends on the version of Docker Compose itself.

Because that is container_name and it was always that.

PS: Please follow our guide to format your post next time: How to format your forum posts

Sorry for the bad format, thanks for your answers.
People like you are precious may god bless you <3

1 Like