LoginSignup
2
1

More than 1 year has passed since last update.

Docker ScanでSnykへのAPI Tokenを使った認証を行う方法

Last updated at Posted at 2021-06-13

新しく使えるようになった docker scan コマンドをテストしているといつからか以下のメッセージが出力されるようになりました。

$ docker scan hello-world
You have reached the scan limit of 10 monthly scans without authentication.
For additional monthly scans, sign into or sign up for Snyk for free with the following command:
`docker scan --login`

Docker ScanはSnykのエンジンを使っているため、匿名は回数制限されていて、アカウントの作成が必要になるようです。

Docker Scan runs on Snyk engine, providing users with visibility into the security posture of their local Dockerfiles and local images.
https://docs.docker.com/engine/scan/

ガイドの通りログインしていみます。自身のLinux環境だと以下のような感じです。

$ docker scan --login

To authenticate your account, open the below URL in your browser.
After your authentication is complete, return to this prompt to start using Snyk.

https://snyk.io/login?token=TOKENTOKENTOKEN&utm_medium=Partner&utm_source=Docker&utm_campaign=Docker-Desktop-2020&os=linux&docker=true

ブラウザから認証してあげます。

image.png

image.png

ただ、CLI側は何故かエラーに。

Authentication failed. Please check the API token on https://snyk.io

APIトークンを指定してログオン

何度か試してみたのですが、上手くいかなかったのでAPI Tokenを自分で取得して自分でログオンすることにしました。

以下にアクセスします。ここまでの手順を行っていれば自動でログオンされるはずですし、DockerHubのIDで再度ログオンしても大丈夫です。

API Tokenは以下の click to show で表示されます。

image.png

このAPI Tokenを使って docker scan --login を行うことでDocker CLIからもSnykへログインできます。

$ docker scan --login --token TOKENTOKENTOKEN
Your account has been authenticated. Snyk is now ready to be used.
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1