Skip to content

Developer's Guide

Eric Marti edited this page Dec 12, 2020 · 4 revisions

Building your own image

Before you try to build, ensure that you have docker installed and running:

$ docker version
Client: Docker Engine - Community
 Cloud integration: 1.0.2
 Version:           19.03.13
 API version:       1.40
 Go version:        go1.13.15
 Git commit:        4484c46d9d
 Built:             Wed Sep 16 16:58:31 2020
 OS/Arch:           darwin/amd64
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          19.03.13
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       4484c46d9d
  Built:            Wed Sep 16 17:07:04 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.3.7
  GitCommit:        8fba4e9a7d01810a393d5d25a3621dc101981175
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

If you see an Error response from daemon: dial unix docker.raw.sock: connect: connection refused error, please see this support page: Docker Docs

To speed up the build process, pull the latest image from Docker Hub:

$ docker pull ericjmarti/inventory-hunter:latest

Finally, to build your own Docker image, run the following command from the inventory-hunter directory:

$ docker build -t my-inventory-hunter .

Note: The docker build command may take a while to complete. If you experience errors during the build, check to see if there is sufficient memory available on your build host.

Running your own image

By default, the docker_run.bash and docker_run.ps1 scripts use the official image from Docker Hub. To start a container with your newly-built image, run:

# Bash:
$ ./docker_run.bash -z -i my-inventory-hunter ...

# PowerShell:
PS C:\dev\inventory-hunter> .\docker_run.ps1 -Image my-inventory-hunter ...

These scripts add the --rm flag to the docker run command by default. This flag instructs Docker to clean up the container after it exits, which is convenient for most users of inventory-hunter. However, it does mean that if an exception is thrown, the traceback will be lost. You can instruct docker_run.bash to omit the --rm flag by adding the -z flag as shown above.

Clone this wiki locally