docker / docker/secrets-engine

Docker pass secrets don't work with docker compose build

Open
#584 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
91
Forks
16
Avg merge
9h 3m
Merged PRs (30d)
24

Description

The documentation states the following:

Anywhere Docker accepts an environment-variable value, write se://<id|pattern> and the engine resolves it just before the container starts.

This does not appear to apply to docker compose build. Here's a minimal project demonstrating the issue:

Dockerfile:

FROM alpine:latest AS base

WORKDIR /test

RUN --mount=type=secret,id=test_auth,env=TEST_AUTH \
  echo $TEST_AUTH > result.txt

CMD ["cat", "/test/result.txt"]

docker-compose.yml

services:
  app:
    build:
      context: .
      dockerfile: ./Dockerfile
      secrets:
        - test_auth

secrets:
  test_auth:
    environment: se://TEST_AUTH

Reproduction:

docker pass plugins enable 1password-cli
docker pass set TEST_AUTH="Hello world!"
docker compose build
docker compose run --rm app

Expected output: Hello world!
Actual output: Nothing

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal Dockerfile and docker-compose.yml in the issue, then run the listed docker pass and docker compose commands to reproduce the missing secret during the build. Trace how the environment-backed secret is passed through docker compose build; done means the example prints Hello world! when the app runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose
Domain
build-system, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.