Newbie to coding and docker, my issue is probably obvious

I’m new to Docker and literally only a few hours into learning containers. I have a new job where I’m tasked to document the applications even though I have no experience with application development or coding. I’m trying to learn Docker containers etc so that I can help write the documents for developers.

I found my first project that would be perfect to learn after I ran through the docker tutorial successfully. I found a blog that is well written on how to create a lamp stack where Apache, PHP and MySQL run in separate containers in a persistent state.

I’m getting an error when starting the docker compose for each of the services as follows:
Unsupported config option for services: ‘mysql’
Unsupported config option for services: ‘php’
Unsupported config option for services: ‘mysql’
I have no idea what is causing the error and would appreciate the help

guess I can’t attach a file, hopefully after pasting my docker-compose.yml content, I will have to edit in order for indents to properly be displayed here.
build: ‘./apache’
restart: always
- 80:80
- 443:443
- frontend
- backend
- ./public_html:/usr/local/apache2/htdocs
- ./cert/:/usr/local/apache2/cert/
- php
- mysql
build: ‘./php’
restart: always
- backend
- ./public_html:/usr/local/apache2/htdocs
- ./tmp:/usr/local/tmp
build: ‘./mysql’
restart: always
- backend
- ./database:/var/lib/mysql

SORRY, the above content for docker-compose.yml is properly indented in the editor but the indents actually disappear in the forum. That said, I don’t believe its an indexing issue

Below is the content of the dockerfile
FROM httpd:2.4.35-alpine
RUN apk update;
apk upgrade;
COPY ./apache.conf /usr/local/apache2/conf/httpd.conf

FROM mysql:8.0.13
ENV MYSQL_ROOT_PASSWORD ## place holder for password was replaced ##
COPY my.cnf /etc/mysql/

FROM php:7.3-rc-fpm-alpine
RUN apk update;
apk upgrade;
RUN docker-php-ext-install mysqli
RUN apk add freetype libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev
RUN docker-php-ext-install -j$(nproc) iconv
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install -j$(nproc) gd
COPY php.ini /usr/local/etc/php/php.ini

Hello surfingjoe,

Is that all the error message ?
Check out the indentation issue first.
Did you compare your compose file option is incompatible with the engine version you are attempting to run against ?

Best Regards,

Did you notice the </> icon for preformatted text when writing text/replying to a thread? Paste your docker-compose.yml content into the editor (make sure to have an empty line between your last written line and the pasted content, mark the content and click on the </> icon to set the marked text to “preformatted text”.

Without seeing the indention of your real files, it is way harder to figure out what the issue might be.

These errors usually indicate some indentation is off in docker-compose.yml. Because it’s a YAML file, indentation matters. Only spaces are allowed, no tabs.

Thank you, I didn’t notice that option. Will do so in the future to show the indentation

Figured it out. At first when I read your reply, it didn’t hit me what you meant by version. I was missing the version of docker to use that will support volumes apparently. Once I put 'version: ‘3.7’ into the YAML file it worked. Additionally because I was trying to build a LampStack in three separate containers, I figured out it was best to put the dockerfiles and associate configuration files in sub-directories, then everything worked great. Thank You, mentioning “version” did the trick