python-on-whales
python-on-whales copied to clipboard
BuilderInspectResult.__init__() missing 1 required positional argument: 'status'
Hello,
When using your library, I am confronted with this exception:
Traceback (most recent call last):
File "/workspaces/myproject/build_push.py", line 68, in <module>
docker.buildx.build(
File "/workspaces/myproject/.venv/lib/python3.11/site-packages/python_on_whales/components/buildx/cli_wrapper.py", line 370, in build
will_load_image = self._build_will_load_image(builder, push, load, output)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspaces/myproject/.venv/lib/python3.11/site-packages/python_on_whales/components/buildx/cli_wrapper.py", line 420, in _build_will_load_image
if self.inspect(builder).driver == "docker":
^^^^^^^^^^^^^^^^^^^^^
File "/workspaces/myproject/.venv/lib/python3.11/site-packages/python_on_whales/components/buildx/cli_wrapper.py", line 488, in inspect
return Builder(self.client_config, x, is_immutable_id=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspaces/myproject/.venv/lib/python3.11/site-packages/python_on_whales/components/buildx/cli_wrapper.py", line 38, in __init__
super().__init__(client_config, "name", reference, is_immutable_id)
File "/workspaces/myproject/.venv/lib/python3.11/site-packages/python_on_whales/client_config.py", line 186, in __init__
self._fetch_and_parse_inspect_result(reference_or_id)
File "/workspaces/myproject/.venv/lib/python3.11/site-packages/python_on_whales/components/buildx/cli_wrapper.py", line 53, in _fetch_and_parse_inspect_result
return BuilderInspectResult.from_str(inspect_str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspaces/myproject/.venv/lib/python3.11/site-packages/python_on_whales/components/buildx/models.py", line 30, in from_str
return cls(**result_dict)
^^^^^^^^^^^^^^^^^^
TypeError: BuilderInspectResult.__init__() missing 1 required positional argument: 'status'
I used the following command:
build_args = {
'BUILD_DATE': datetime.now().strftime('%Y-%m-%dT%H:%M:%SZ'),
}
docker.buildx.build(
context_path="mypath/",
tags=[f"{myrepos}:{tag}" for tag in tags],
platforms=["linux/amd64"],
build_args=build_args,
push=False,
stream_logs=False,
)
Docker version :
Client: Docker Engine - Community
Version: 20.10.23
API version: 1.41
Go version: go1.18.10
Git commit: 7155243
Built: Thu Jan 19 17:34:13 2023
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.23
API version: 1.41 (minimum version 1.12)
Go version: go1.18.10
Git commit: 6051f14
Built: Thu Jan 19 17:32:04 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.15
GitCommit: 5b842e528e99d4d4c1686467debf2bd4b88ecd86
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Would you have a lead to unblock me? Thank you!
Finally, I found the problem. I'm working in a devcontainer in VSCode. The docker.sock
was not mounted in my devcontainer.
Is it possible to ping the docker.sock to have an error easier to interpret?
Command that allowed the debug :
$ /root/.cache/python-on-whales/docker-cli/20.10.5/docker version
Client: Docker Engine - Community
Version: 20.10.5
API version: 1.41
Go version: go1.13.15
Git commit: 55c4c88
Built: Tue Mar 2 20:14:11 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Resolution in devcontainer.json:
"mounts": ["source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"]
Sorry for the delay. As I understand it, if the socket is not available, the command should exit with an non-zero exit code and thus not proceed with parsing the output. It is quite strange. I will try to reproduce locally. Thanks for the bug report!
This issue can occur if your user is not apart of the docker group, so make sure that your user is added to the docker group.