Search code examples
dockersnyk

docker scan <REPOSITORY>:<TAG> - failed to get DockerScanID: bad status code "400 Bad Request"


I am trying to run

docker scan <REPOSITORY>:<TAG>

but it fails with error

failed to get DockerScanID: bad status code "400 Bad Request"

notes:

  • I'm logged in to hub.docker.com
    enter image description here
  • I created a token in docker which I use in snyk.com

I probably miss something else... any clues? thanks


Solution

  • you have to log in to snyk via the cli:

    docker scan --login
    

    then you have to enter the credentials in the browser. after that you are able to run

    docker scan <REPOSITORY>:<TAG>
    

    note: responding with a 400 error is a bit misleading. responding with a 401 or 403 (and maybe even saying you have to authenticate with "docker scan --login" would have made it more human readable :|