HomeSetup Developer Handbook
Developer-Tools
Table of contents
Docker functions
__hhs_docker_count
usage: __hhs_docker_count
Purpose
Count the number of active docker containers.
Returns
0 if the command executed successfully; non-zero otherwise.
Parameters
N/A
Examples
__hhs_docker_count
Output
1
__hhs_docker_info
usage: __hhs_docker_info <container_id>
Purpose
Display information about the container.
Returns
0 if the command executed successfully; non-zero otherwise.
Parameters
- $1 Required : The active container ID.
Examples
__hhs_docker_info 5d903d749ba1
Output
5d903d749ba1 postgres:latest "docker-entrypoint.s…" 6 days ago Up 6 days (healthy) 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp postgres
__hhs_docker_exec
usage: __hhs_docker_exec <container_id> [shell_cmd]
Notes:
- If shell_cmd is not provided '/bin/sh' will be used.
Purpose
Run a command or bash in a running container.
Returns
0 if the command executed successfully; non-zero otherwise.
Parameters
- $1 Required : The active container ID.
- $2 Optional : The command to be executed on the container.
Examples
__hhs_docker_exec 6ae3b31765d2 redis-cli
Output
127.0.0.1:6379>
__hhs_docker_compose_exec
usage: __hhs_docker_compose_exec <container_id> [shell_cmd]
Purpose
This is the equivalent of docker exec, but for docker-compose.
Returns
0 if the command executed successfully; non-zero otherwise.
Parameters
N/A
- $1 Required : The active container ID.
- $2 Optional : The command to be executed on the container.
Examples
__hhs_docker_compose_exec 6ae3b31765d2
Output
#
__hhs_docker_logs
usage: __hhs_docker_logs <container_id>
Purpose
Fetch the logs of a container.
Returns
0 if the command executed successfully; non-zero otherwise.
Parameters
N/A
- $1 Required : The active container ID.
Examples
__hhs_docker_logs 6ae3b31765d2
Output
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/postgresql/data ... ok
...
...
__hhs_docker_remove_volumes
usage: __hhs_docker_remove_volumes
Purpose
Remove all docker volumes not referenced by any containers (dangling).
Returns
0 if the command executed successfully; non-zero otherwise.
Parameters
N/A
Examples
__hhs_docker_remove_volumes
Output
Removing dangling docker volume: e902d7f1c34c1cd1a7f65e0100f93f345d3bd40bec2eb304b2a5fa5ee712fb9b... OK
Removing dangling docker volume: postgres_postgres-data... OK
__hhs_docker_kill_all
usage: __hhs_docker_kill_all [-a]
Options:
-a : Remove active and inactive volumes; othewise it will only remove inactive ones.
Purpose
Stop, remove and remove dangling [active?] volumes of all docker containers.
Returns
0 if the command executed successfully; non-zero otherwise.
Parameters
- $1 Optional : If specified, also remove active containers.
Examples
__hhs_docker_kill_all -a
Output
Stopping Docker container: 13f21a0fe4f3... OK
Removing Docker container: 13f21a0fe4f3... OK
Removing dangling docker volume: 9ffc71829b4e2d8e2221e8285aef0112472fa40df1fb57fdcf810fd415ed5f99... OK
Removing dangling docker volume: postgres_postgres-data... OK