Cannot use a parameter variable when running docker commands
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.7k
- Avg merge
- 13d 8h
- Merged PRs (30d)
- 2
Description
I have spent several hours trying to get the following example working
import docker
client = docker.from_env()
# using a list of image strings formatted "<registry>:<image>:<tag>"
for image in images:
container_id = client.containers.create(image)
This results with the following error:
ERROR - 400 Client Error for http+docker://localhost/v1.48/containers/create: Bad Request ("invalid reference format")
but if I put the exact image string in place of the variable image in the above client.containers.create(image) then it works fine.
I need to be able to iterate through images for my purpose and it seems funny that I have to hard code the parameters used by API?
Any help or advice is appreciated, if this is currently possible
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the client.containers.create(image) entry point and reproduce the request using the reported variable-based and hard-coded image values. Inspect the actual image strings sent to Docker and compare the resulting errors; done means identifying whether the behavior is a library bug or an input-formatting issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- api, devops
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100