hello,
i’m trying to use docker compose, unfortunately i get these errors:
version install: Docker version 27.4.1, build b9d17ea - docker-compose version 1.29.2, build unknown
file docker-compose.yml
version: ‘3’
services:
dockerapp:
build: .
ports:
“5000:5000”
dipends_on:
redis
redis:
image: redis:3.2.0
how can i fix it?
thanks.
I think you forgot to mention the error message, but your compose is definitely not supported anymore. Use Docker Compose v2 as recommended in the documentation.
Also, please, when you share coe or error messages, follow our formatting guide and use code blocks:
hello,
i’m trying to use docker compose, unfortunately i get these errors:
version install: Docker version 27.4.1, build b9d17ea - docker-compose version 1.29.2, build unknown
Ubuntu: Ubuntu 24.10
Dockerfile:
FROM python:3.5
RUN pip install Flask==0.11.1 redis==2.10.5
RUN useradd -ms /bin/bash admin
USER admin
WORKDIR /app
COPY app /app
CMD ["python", "app.py"]
ERROR: yaml.parser.ParserError: while parsing a block mapping
in "./docker-compose.yml", line 1, column 1
expected <block end>, but found '<block mapping start>'
in "./docker-compose.yml", line 7, column 2
By any chance, are you using docker-compose instead of docker compose to deploy the compose project?
My bad: you do! You already shared this information.
Docker compose v1 (as in docker-compose) was deprecated long time ago. Docker compose v2 is a docker cli plugin. The current version should be v2.26.0.
5-6 years in DevOps is a lot, but what does a Kubernetes course has t do with Docker Compose and Docker? I assume it is because 5 years ago the default container runtime in Kubernetes was Docker, but you would still not create compose files unless the course starts with compose before introducing Kubernetes.
Regardless of what the course is about, it is a Docker Community Forum, so you can ask about Docker.
Also instead of relying entirely on a 5 or 6 years old course, read about the components it mentions and always look for them in official documentations first