docker / docker/docker-py

"{ValueError} scheme http+docker is invalid" raised when attaching WebSocket

Open
#1,478 3 comments 0 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

When trying to attach a WebSocket, a {ValueError} scheme http+docker is invalid raised.
Using docker-py==2.1, websocket-client==0.40.0, docker 1.12.5.
Executing the following before/after container run command brings out the same result. The Code used to attach a new WebSocket is as follows:

sock = self.client.api.attach_socket(self.container_id, params={ 'origin': 'http://127.0.0.1:4502' }, ws=True)

The Exception is actually raised from the websocket.create_connection function. This is the URL passed to the create_connection function (generated by docker-py):
http+docker://localunixsocket/v1.24/containers/50aa7d8e10a0a15ffc659e754ebfbe230981dde16d739b53d729d20fea8c1c41/attach/ws?origin=http%3A%2F%2F127.0.0.1%3A4502

Is this a bug or miss-usage? I've gone over the tests and there does't seem to be an attach_socket test that uses websocket.

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

Start with the attach_socket call shown in the issue and trace the URL passed to websocket.create_connection. Reproduce the http+docker scheme error with the listed dependency versions, then inspect the existing tests, which do not cover WebSocket attachment. Done means WebSocket attachment works without this ValueError and has regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
api, backend
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.