Skip to main content

Wraps Docker to run with GitLab build variables

Project description

|Build Status| || |PyPI version|

Docker With GitLab Secrets

*Wraps Docker to run with GitLab build variables.*


Prerequisites: - Python >= 3.6 - docker

Stable releases can be installed via
`PyPI <>`__:

.. code:: bash

$ pip install dockerwithgitlabsecrets

Bleeding edge versions can be installed directly from GitHub:

.. code:: bash

$ pip install git+


Wrap your prefixed Docker command with:

.. code:: bash

usage: docker-with-gitlab-secrets [-h] [--dwgs-config DWGS_CONFIG]
[--dwgs-project DWGS_PROJECT]
[--env-file ENV_FILE]

Docker With GitLab Secrets

optional arguments:
-h, --help show this help message and exit
--dwgs-config DWGS_CONFIG
location of the configuration file (will default to
--dwgs-project DWGS_PROJECT
GitLab project (if not namespaced in the form
"namespace/project", the default namespace defined in
the configuration file will be used). If not defined,
the default project in the configuration file will be


Run a new container with secrets from a GitLab project:

.. code:: bash

docker-with-gitlab-secrets --dwgs-config my-config.yml --dwgs-project my-project \
run --rm alpine printenv GITLAB_SECRET

Wrapping unrelated Docker commands will still work:

.. code:: bash

docker-with-gitlab-secrets --dwgs-config my-config.yml \

Run a container interactively that will have secrets from a GitLab
project in the environment:

.. code:: bash

docker-with-gitlab-secrets --dwgs-config my-config.yml --dwgs-project my-project \
run --rm -it ubuntu



.. code:: yml

token: my-token
project: hgi-systems # Optional default project, which will be overriden by if `dwgs-project` is specified
namespace: hgi # Optional default namespace

Known Issues

- Docker `cannot pass newlines in variables via
``--env-file`` <>`__.
Therefore multiline GitLab variables with have their line-breaks
escaped to \\n.

.. |Build Status| image::
.. || image::
.. |PyPI version| image::

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dockerwithgitlabsecrets, version 2.0.1
Filename, size File type Python version Upload date Hashes
Filename, size dockerwithgitlabsecrets-2.0.1.tar.gz (8.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page