npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

docker-image-not-found

v1.1.1

Published

Check if a docker image does not exist in the docker hub registry

Downloads

71

Readme

docker-image-not-found CircleCI

If you want to do something only if the Docker Hub does not have an image

Only exits with 0 if the Docker registry positively responds with "image not found" response. Any other response (found, network error, etc) will exit with 1.

Use

Image does not exist

npx docker-image-not-found --repo cypress/base:nope
got an error fetching info about Docker image docker.io/cypress/base:nope
Got definite NotFoundError
exiting with code 0

The only case when this script exits with 0

Image exists

npx docker-image-not-found --repo cypress/base:8.9.3
found image docker.io/cypress/base:8.9.3
exiting with code 1

Network is down

$ ./bin/docker-image-not-found docker-image-not-found --repo cypress/base:nope
got an error fetching info about Docker image docker.io/cypress/base:nope
got an error other than image not found
Error: getaddrinfo ENOTFOUND registry-1.docker.io
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) {
  [stack]: 'Error: getaddrinfo ENOTFOUND registry-1.docker.io\n' +
    '    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26)',
  [message]: 'getaddrinfo ENOTFOUND registry-1.docker.io',
  errno: 'ENOTFOUND',
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'registry-1.docker.io'
}
exiting with code 1

API

To use this utility as a module

dockerImageNotFound

const di = require('docker-image-not-found')
const notFound = await di.dockerImageNotFound('image name')
// notFound is true only if the registry has responded with "NotFound"

listTags

Returns list of tags

const di = require('docker-image-not-found')
await di.listTags('cypress/included')
{
  name: 'cypress/included',
  tags: [
    '3.2.0', '3.3.0', '3.3.1',
    '3.3.2', '3.4.0', '3.4.1',
    '3.5.0', '3.6.0', '3.6.1',
    '3.7.0', '3.8.0', '3.8.1',
    '3.8.2', '3.8.3', '4.0.0',
    '4.0.1', '4.0.2', '4.1.0'
  ]
}

Misc

Debugging

Run this tool with DEBUG=docker-image-not-found environment variable to see additional debug logs