sakurashinken
sakurashinken

Reputation: 4078

Docker-compose failing on startup

I am running

docker-compose version 1.25.4, build 8d51620a

on

OS X Catalina, v10.15.4 (19E266)

I am using the system python.

When I run docker-compose, it crashes with the following error:

    Traceback (most recent call last):
  File "docker-compose", line 6, in <module>
  File "compose/cli/main.py", line 72, in main
  File "compose/cli/main.py", line 128, in perform_command
  File "compose/cli/main.py", line 1077, in up
  File "compose/cli/main.py", line 1073, in up
  File "compose/project.py", line 548, in up
  File "compose/service.py", line 355, in ensure_image_exists
  File "compose/service.py", line 381, in image
  File "site-packages/docker/utils/decorators.py", line 17, in wrapped
docker.errors.NullResource: Resource ID was not provided
[9018] Failed to execute script docker-compose

I have tried a fresh repo clone and a fresh install of docker, neither work. What could be causing this?

Upvotes: 17

Views: 13364

Answers (4)

Espoir Murhabazi
Espoir Murhabazi

Reputation: 6396

It can be initialized environment variables but for my case, it was some other command before docker-compose build which was failing.

  • I was pulling images from the registry but it could not find them.

Upvotes: 2

Redplane
Redplane

Reputation: 3151

I faced with the same issue. In my case, it was different.

I had 2 docker-compose files:

  • docker-compose.yml
version: "3"
networks:
  web: {}
  • docker-compose.development.yml
version: "3"

services:
  web:
    image: ""
    build:
      context: .
      dockerfile: Dockerfile
    environment:
      API_URL: http://example.com/api
    ports:
      - "11000:22000"
    networks:
      - web
    restart: on-failure

The problem was from image property in docker-compose.development.yml file.

When I removed it & ran the below command:

docker-compose --project-name my-web -f docker-compose.yml -f docker-compose.development.yml up --detach

It was successful. This is the new docker-compose.development.yml file:

version: "3"

services:
  web:
    build:
      context: .
      dockerfile: Dockerfile
    environment:
      API_URL: http://example.com/api
    ports:
      - "11000:22000"
    networks:
      - web
    restart: on-failure

Upvotes: 1

ConorSheehan1
ConorSheehan1

Reputation: 1725

I've seen this error when passing docker-compose files explicitly and omitting one. e.g.

docker-compose -f docker-compose.yml up # fails
docker-compose -f docker-compose.yml -f docker-compose.override.yml up # works

Upvotes: 1

sakurashinken
sakurashinken

Reputation: 4078

It turned out that I had uninitialized environment variables that were causing the crash.

The particular cause was the env vars setting image names in the docker-compose file and then trying to pull a blank image.

Upvotes: 33

Related Questions