Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: Service backend has neither an image nor a build context for docker compose on Debian-based distributions. #208

Closed
oickrwens opened this issue Dec 31, 2022 · 4 comments

Comments

@oickrwens
Copy link

The docker compose up --build
command gives the following error:

ERROR: The Compose file is invalid because:Service backend has neither an image nor a build context specified. At least one must be provided.

In order to fix the issue on Debian-based distros the docker-compose-plugin needs to be installed with:

apt install docker-compose-plugin

@onegunsamurai
Copy link
Contributor

onegunsamurai commented Dec 31, 2022

@oickrwens I've just built it on my Ubuntu 22 without this issue poping up. Could you specify what distro are you using so I can reproduce this issue? Or simply try:

  backend:
    build:
      context: .
      dockerfile: docker/Dockerfile.backend

@oickrwens
Copy link
Author

Hi, I was experiencing issues on Debian 11 and Ubuntu 22.04, but got it to work on both.

Basically, there is an issue with the docker compose tool. By default docker does not include compose in the Linux version: docker/compose#8630
so the docker compose command will give: command docker: 'compose' is not a docker command error.

Instead what needs to be used is docker-compose which is a separate package that needs to get installed.

However, after installing the package and running the command docker-compose up --build there is yet another error:
ERROR: The Compose file './docker-compose.yaml' is invalid because: services.backend.depends_on contains an invalid type, it should be an array services.web.depends_on contains an invalid type, it should be an array' likely caused by the difference in the compose versions.

I found that installing the docker-compose-plugin fixes all the issues.

sudo apt update
sudo apt install docker-compose
sudo apt install docker-compose-plugin

Docker version for Ubuntu: Docker version 20.10.12, build 20.10.12-0ubuntu4
Docker version for Debian: Docker version 20.10.5+dfsg1, build 55c4c88 on Google Compute Engine

@croumegous
Copy link
Collaborator

@yk
Copy link
Collaborator

yk commented Jan 1, 2023

Thank you all. I've added a reference to the project's README. Let me know in case this issue pops up again or remains.

@yk yk closed this as completed Jan 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants