senzacionale
senzacionale

Reputation: 20916

Docker 409 Client error. How to get real error and see the real log in container?

I am struggling with docker and akka.net

I am always getting this error but I do not know how to check what throws this error? Is it possible to check logoutput of the container or somehow see the output?

Error:

Exception in thread Thread-9:
Traceback (most recent call last):
  File "site-packages\docker\api\client.py", line 246, in _raise_for_status
  File "site-packages\requests\models.py", line 940, in raise_for_status
requests.exceptions.HTTPError: 409 Client Error: Conflict for url: http+docker://localnpipe/v1.30/containers/4d9d4008ccc0abacbee66357ff73e351df9997d7ec0cda8d0e0a696edf489eed/attach?logs=0&stdout=1&stderr=1&stream=1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "threading.py", line 916, in _bootstrap_inner
  File "threading.py", line 864, in run
  File "compose\cli\log_printer.py", line 233, in watch_events
  File "compose\container.py", line 215, in attach_log_stream
  File "compose\container.py", line 307, in attach
  File "site-packages\docker\utils\decorators.py", line 19, in wrapped
  File "site-packages\docker\api\container.py", line 57, in attach
  File "site-packages\docker\api\client.py", line 385, in _read_from_socket
  File "site-packages\docker\api\client.py", line 296, in _get_raw_response_socket
  File "site-packages\docker\api\client.py", line 248, in _raise_for_status
  File "site-packages\docker\errors.py", line 19, in create_api_error_from_http_exception
  File "site-packages\requests\models.py", line 880, in json
  File "site-packages\requests\models.py", line 828, in content
  File "site-packages\requests\models.py", line 750, in generate
  File "site-packages\urllib3\response.py", line 494, in stream
  File "site-packages\urllib3\response.py", line 442, in read
  File "http\client.py", line 449, in read
  File "http\client.py", line 493, in readinto
  File "site-packages\docker\transport\npipesocket.py", line 209, in readinto
  File "site-packages\docker\transport\npipesocket.py", line 20, in wrapped
RuntimeError: Can not reuse socket after connection was closed.

Upvotes: 3

Views: 18560

Answers (2)

elembie
elembie

Reputation: 640

I got this same error and as @otong mentions in the comments, looking into the log using docker-compose --log-level DEBUG it was actually an issue in a shell script;

/usr/bin/env: ‘bash\r’: No such file or directory

The problem was that I'm checking out files from git using the option to checkout with windows line endings e.g. \r\n. However, the docker container is obviously runs linux, at which point the shell script wont run correctly.

Solution is to temporarily check out files with the linux endings (see details on how to change options).

Or for a quick fix - open the scripts in Notepad++ and replace all \r with a blank.

Upvotes: 1

Konrad
Konrad

Reputation: 1002

If you want to see logs from service use docker-compose logs service_name, where service_name is key provided in services in docker-compose.yaml There are useful options like -f or --tail, more in docs

Upvotes: 3

Related Questions