dockerazure-devopsdocker-composeazure-pipelinescredential-manager

Azure Pipeline: Can not access Credentials Helper Store due to missing tty


on my target Ubuntu machine I installed docker, docker compose and pass (as credentials store).

So this is what my ~/.docker/config.json file looks like:

{
        "auths": {
                "whatever.azurecr.io": {}
        },
        "credsStore": "pass"
}

The problem is, that my set GPG Key is password protected. If I ssh into the host and wanted to pull the newest docker image via

docker compose up --force-recreate -d

, I would get this error:

exit status 1, out: `exit status 2: gpg: public key decryption failed: No such file or directory

If in the same session I execute this command, it works great:

export GPG_TTY=$(tty)

Now my problem is that I need to execute the docker compose command automatically via an Azure pipeline. This is the step that I'm struggling with:

- bash: |
    export GPG_TTY=$(tty)
    echo "GPG_TTY: $GPG_TTY"
    echo "Starting all Docker Containers..."
    docker compose up --force-recreate -d

The first echo command outputs

GPG_TTY: not a tty

And then I get the same "No such file..." error shown above. What am I missing here?

Thanks a lot


Solution

  • Ok, I don't know whether this is the smoothest solution, but at least I am now able to execute a headless Azure Pipeline Deployment to my target server.

    Before I call the docker compose command, I execute this:

    gpg --pinentry-mode loopback --passphrase "$(GPG_KEY_PASSPHRASE)" --decrypt $(GPG_PASSWORD_STORE_PATH)

    where $(GPG_PASSWORD_STORE_PATH) represents the path to the .gpg file. Then my docker compose command works.