Docker Hub + Steampipe
Docker Hub is a cloud-based repository and distribution service provided by Docker that allows developers to store and share container images.
Steampipe is an open-source zero-ETL engine to instantly query cloud APIs using SQL.
List your Docker Hub Repositories:
select name, pull_count, star_count, is_private, last_updatedfrom dockerhub_repository;
+------------------------+------------+------------+------------+---------------------------+| name | pull_count | star_count | is_private | last_updated |+------------------------+------------+------------+------------+---------------------------+| souravthe/test | <null> | <null> | false | 2023-07-17T18:26:25+05:30 || souravthe/test-private | <null> | <null> | true | 2023-07-17T18:32:56+05:30 |+------------------------+------------+------------+------------+---------------------------+
Documentation
Quick start
Install
Download and install the latest Docker Hub plugin:
steampipe plugin install dockerhub
Credentials
Item | Description |
---|---|
Credentials | Docker Hub plugin requires username and password . |
Permissions | NA |
Radius | Each connection represents one Docker Hub user. |
Resolution | 1. Credentials explicitly set in a steampipe config file (~/.steampipe/config/dockerhub.spc ).2. Credentials specified in environment variables, e.g., DOCKER_HUB_USERNAME and DOCKER_HUB_PASSWORD . |
Configuration
Installing the latest Docker Hub plugin will create a config file (~/.steampipe/config/dockerhub.spc
) with a single connection named dockerhub
:
Configure your account details in ~/.steampipe/config/dockerhub.spc
:
connection "dockerhub" { plugin = "dockerhub"
# DockerHub Username. Required. # This can also be set via the 'DOCKER_HUB_USERNAME' environment variable. # username = "turbot"
# DockerHub Password. Required. # This can also be set via the 'DOCKER_HUB_PASSWORD' environment variable. # password = "turbot@123"
# DockerHub 2FA Code. Required when 2FA is enabled. # two_factor_code = "123456"}
Alternatively, you can also use the standard Docker Hub environment variables to configure your credentials only if other arguments (username
and password
) are not specified in the connection:
export DOCKER_HUB_USERNAME=turbotexport DOCKER_HUB_PASSWORD=turbot@123
Postgres FDW
This plugin is available as a native Postgres FDW. Unlike Steampipe CLI, which ships with an embedded Postgres server instance, the Postgres FDW can be installed in any supported Postgres database version.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_postgres_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/postgres.sh)" -- dockerhub
The installer will prompt you for the plugin name and version, download and install the appropriate files for your OS, system architecture, and Postgres version.
To configure the Postgres FDW, you will create an extension, foreign server, and schema and import the foreign schema.
CREATE EXTENSION IF NOT EXISTS steampipe_postgres_dockerhub;CREATE SERVER steampipe_dockerhub FOREIGN DATA WRAPPER steampipe_postgres_dockerhub OPTIONS (config '<your_config>');CREATE SCHEMA dockerhub;IMPORT FOREIGN SCHEMA dockerhub FROM SERVER steampipe_dockerhub INTO dockerhub;
SQLite Extension
This plugin is available as a SQLite Extension, making the tables available as SQLite virtual tables.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_sqlite_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/sqlite.sh)" -- dockerhub
The installer will prompt you for the plugin name, version, and destination directory. It will then determine the OS and system architecture, and it will download and install the appropriate package.
To configure the SQLite extension, load the extension module and then run the steampipe_configure_dockerhub
function to configure it with plugin-specific options.
$ sqlite3sqlite> .load ./steampipe_sqlite_extension_dockerhub.sosqlite> select steampipe_configure_dockerhub('<your_config>');
Export
This plugin is available as a standalone Export CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- dockerhub
You can pass the configuration to the command with the --config
argument:
steampipe_export_dockerhub --config '<your_config>' <table_name>