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

Compose.pull() fails when a service doesn't provide an 'image' property #42

Open
loriswit opened this issue Feb 23, 2024 · 0 comments
Open

Comments

@loriswit
Copy link

I have the following compose file:

services:
  web:
    build: .
    ports:
      - "8000:8000"
    environment:
      DB_HOST: db
  db:
    image: "postgres"
    environment:
      POSTGRES_PASSWORD: postgres

Running compose.pull() triggers the following error:

node_modules/dockerode/lib/util.js:48
  var digestPos = input.indexOf('@');
                        ^

TypeError: Cannot read properties of undefined (reading 'indexOf')
    at module.exports.parseRepositoryTag (node_modules/dockerode/lib/util.js:48:25)
    at Docker.pull (node_modules/dockerode/lib/docker.js:1457:23)
    at Compose.pull (node_modules/dockerode-compose/compose.js:69:41)

I suspect this is related to this piece of code:

async pull(serviceN, options) {
options = options || {};
var streams = [];
var serviceNames = (serviceN === undefined || serviceN === null) ? tools.sortServices(this.recipe) : [serviceN];
for (var serviceName of serviceNames) {
var service = this.recipe.services[serviceName];
try {
var streami = await this.docker.pull(service.image);

At line 69, the code assumes there's always an image property in the service. However, as shown in my compose file, there's no such property in the web service.

This should be easily fixable by skipping services that don't provide an image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant