docker / docker/docker-py

passing buildargs to client.build() doesnt work

Open
#2,957 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
1.7k
Avg merge
13d 8h
Merged PRs (30d)
2

Description

using a Dockerfile similar to the following:

ARG BASE_IMAGE="3.6"
FROM amd64/python:${BASE_IMAGE}-slim-buster
WORKDIR /app
COPY requirements.txt ./
RUN pip install -r requirements.txt
COPY . .
CMD [ "python3", "-u", "./main.py" ]

When using docker client.build() and passing {'BASE_IMAGE': '3.8'} for buildargs is not working. The image generated is using BASE_IMAGE value 3.6. My expectation is that it would work same as though docker build cli command was used.

Contributor guide

Open the contributing guide

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

Reproduce the issue with the provided Dockerfile and a Python client.build() call passing {'BASE_IMAGE': '3.8'} as buildargs. Compare the resulting base image with the Docker CLI behavior, then trace how client.build() forwards build arguments. Done means the generated image uses the requested BASE_IMAGE value and a regression test covers the case.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
api, build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.