This allows you to mount a git repo as a volume in the container and manage it with BlackBox and your host machine's ~/.ssh
and ~/.gnupg
directories.
In the Makefile there are commands for both building and pushing the image to DockerHub.
# Builds an image named 'stevenaldinger/docker-blackbox:latest'
make build \
dockerhub_user='stevenaldinger' \
version="latest"
# Pushes an image to 'stevenaldinger/docker-blackbox:latest'
make push \
dockerhub_user='stevenaldinger' \
version="latest"
In general, when you run this docker image it will set your git user name/email, make sure the gpg agent is running, and create a directory named .blackbox
if it doesn't already exist in the directory mounted at /repo
to store your BlackBox config in. Then it will run any command you pass in.
cd
into the git repo you want to manage with the image.
Then run the container as a daemon:
docker run --rm --name blackbox \
-e GIT_USER_NAME="$(git config --get user.name)" \
-e GIT_USER_EMAIL="$(git config --get user.email)" \
-v $(pwd)/:/repo/ \
-v "$HOME/.ssh":/root/.ssh \
-v "$HOME/.gnupg":/root/.gnupg \
-d stevenaldinger/docker-blackbox:latest \
tail -f /dev/null
cd
into docker-blackbox/examples/- Run ./01.initialize-repo.sh script
- Export your gpg key email address:
export GPG_KEY_EMAIL_ADDRESS='[email protected]'
- Run ./02.add-admin.sh to add yourself as a
BlackBox
admin. - Run ./03.create-sensitive-file.sh to create a
.env
file. - Run ./04.cat-sensitive-file.sh to view the encrypted
.env
file. - Run ./05.edit-sensitive-file.sh to edit the encrypted
.env
file. - Run
docker kill blackbox
to finish up.
The docker-compose.yml configuration runs tail -f /dev/null
inside the container to keep it running and then the example files can be used to execute BlackBox
commands inside the container.
For an example of how this image works:
- Set some important environment variables:
# used in the docker-compose.yml file
export GIT_USER_EMAIL="[email protected]"
export GIT_USER_NAME="Steven Aldinger"
# used in some of the example scripts
export GPG_KEY_EMAIL_ADDRESS='[email protected]'
- Run
docker-compose up -d
- runs a
stevenaldinger/docker-blackbox:latest
container namedblackbox
- creates a new directory
./example-repo
on the host machine for usage the example scripts
- Run through each script in order in the examples/ directory.
A directory of example scripts can be found at examples/ and include: