New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack Trace "ERROR: for web a bytes-like object is required, not 'str'" 1.25.0-rc4 fails to run basic project #6998
Comments
Hello @rfay |
It could certainly be related to the port-forwarding issue in previous docker 2.1.4.0 issue (docker/for-win#4935), although that one did not manifest in the same way - it did not hit a docker-compose problem. My bet is that you'll see the problem right away with this docker-compose file; maybe docker is not providing the expected result? I certainly don't doubt that it's docker's fault. Recent edge releases seem to have all had critical issues. If I were better at python I imagine I could just find "site-packages/docker/api/client.py", line 261, and I'd see what docker is returning that docker-compose doesn't expect. |
I finally found a minimal version: '3.6'
services:
web:
image: nginx
ports:
- 127.0.0.1::80/tcp
- 127.0.0.1::443/tcp Output:
It also doesn't work with
With only one port version: '3.6'
services:
web:
image: nginx
ports:
- 127.0.0.1::80/tcp the container is running but the port forwarding doesn't work because of the unknown source port. We can see it with a docker inspect: "Ports": {
"80/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "32772"
}
]
}, If you set the source port, it just works fine: version: '3.6'
services:
web:
image: nginx
ports:
- 127.0.0.1:80:80/tcp
- 127.0.0.1:443:443/tcp And inspect looks good: "Ports": {
"80/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "80"
}
]
}, You can refer to the docker compose documentation about ports to see the different allowed syntaxes: https://docs.docker.com/compose/compose-file/#ports |
Nice work. It would be nice to fix docker-compose to handle this (much) more gracefully of course. I do see the empty published port. That's to get an ephemeral port, and it has always worked in previous docker versions. In the context of this product, we can't just be taking up known localhost ports in advance. (I wonder if it works with the long format if you just leave "published" out) And BIG THANKS for being so responsive on this. |
Ok, so the issue looks like not to be related to random port but with multiple ports exposition. It looks like to be related to some changes in Docker Desktop and not in Docker Compose. A ticket has been opened about it. I'll post an update here when I will have more information about it. |
@rfay The fix should be released as part of the next Edge release. |
Outstanding, thanks so much @eunomie . Nobody had responded on that issue for 22 days... did it get attended to due to your inquiry? If so, THANKS! And again, thanks for your responsiveness on this. I hope docker-compose can also be fixed to be more resilient also, even though the underlying flaw is in docker... |
facing the problem. Any workaround ? |
Rollback docker to version 2.1.3.0 and everything is fine, test the latest release of docker this morning the bug was still there :( |
Yay, Docker desktop edge 2.1.6.0 resolves this. Thanks so much for your work on this @jcsirot. |
@gvanto try to provide a super-simple docker-compose file that will demonstrate this with 2.1.6.0. @eunomie did this in #6998 (comment) - Does that one give you the error? If not, try to trim yours down to get it. |
@gvanto Please also try my docker-compose.yaml in the OP, but I think it will work for you. After that, the best thing is to try to cut yours down piece by piece. Use the "binary search" method, where you delete half of it (by services probably) and see if the problem is still there. Then do it again. Etc. |
Rolled Docker Desktop back to 2.1.0.5 (stable) and works now ... Reason for upgrading to Edge was because it has a more recent Kubernetes version (more relevant to k8s documentation out there atm) |
Hi, I'm having this issue on ubuntu 19.04, docker-compose version:
docker version:
Going back to docker-compose 1.4.21 fixes the issue for me. |
Which version do you mean. Version 1.4.2 doesn't work for me because it says "Unsupported config option for services service: 'db'" |
I have never said version 1.4.2. Going back from docker-compose 1.25.0 to docker-compose 1.24.1 works for me. |
ERROR: for nginx a bytes-like object is required, not 'str' I have the same error on 2.1.0.5 version :( |
Any updates on this? I do not experience this issue, but my coworker does. He is on 2.1.6.0. |
2.1.7.0 / compose 1.25.1-rc1 also doesn't work. Unchanged yaml, just upgraded Docker and now nothing works. 😞 Update: It seems that a broken volume mount causes the same error. In addition to the "bytes-like object" error, I was also getting
(even though that directory is configured to be shared; but that's another issue) Weird... |
Why is this closed? |
I seem to be having the same problem with version docker-compose version:
docker version:
|
Can confirm this issue as well on version 1.25.0, build b42d419. |
I've tried to use the version |
I'm having the same problem with docker compose version
update: |
same
|
Same here.
Using WSL 2:
Is there a known workaround? As it stands I can't use the majority of my containers anymore... |
Appear to be having the same issue here. Stack Trace:
It appears that the format of errors being thrown on container start has changed, such that the explanation is now bytes rather than str.
In compose it's assuming a string - https://github.com/docker/compose/blob/1.25.1-rc1/compose/service.py#L627 The naive fix seems to be to change |
Just confirmed that making the change outlined above fixed the error, and it now correctly passes through the actual error ( Unable to do a PR currently as I'm having other issues on my system, but it's just a simple two-liner changing |
For the posterity: |
I found a solution that worked well for me on Ubuntu. I saw this error happened only when I restarted docker service without stopping the running containers first. Then, when I tried to start them again, this error occured. I tried to see if my ports are available and not running in the background (using lsof -i:PORT) but nothing showed. But, if I tried this command using sudo ( sudo lsof -i:PORT ), I noticed that some PID's were running in the background. So I just killed them using ( sudo kill -9 PID ) and docker was working again properly. Just in case someone still gets in trouble, this might help :) |
For anyone having the same problem, check if the ports that you are binding from docker-compose are free in the host machine. |
same problem,docker-compose version 1.25.0 under ubuntu |
@csquan Please try with the latest version of |
@csquan, please make sure your containers are not trying to use a port that is listening on your host. See below answer from danielts.
|
@jeandoyon's answer was the right one for me. Sure do hope this error could be made more explicative in the future |
yeah, this can be called a self-explaining and very informative error message from docker-compose ... Suggestion: what about a more concrete error message such as "port xyz already in use" |
👋 I'd recommend trying Compose v2 instead of Python Compose (v1). The error messages should be better there. For Linux you can download it here (it will be in the packages soon) and it's included in Docker Desktop. |
In this case, there was a container starting automatically. That is, when I started my work container the error was displayed. Try running Hope this helps. |
Description of the issue
docker-compose (macOS) fails with rc4 (Docker Desktop Mac Edge 2.1.5.0). It looks like there's a syntax error or something.
Context information (for bug reports)
macOS Docker Desktop 2.1.5.0 - on macOS Catalina
Output of
docker-compose version
Output of
docker version
Output of
docker-compose config
(Make sure to add the relevant
-f
and other flags)Steps to reproduce the issue
docker-compose -f badcompose.yaml up
Observed result
Expected result
Stacktrace / full error message
Additional information
Here's the contents of badcompose.yaml. This exact style of yaml has been working for at least 2 years with various versions of docker and docker-compose.
The text was updated successfully, but these errors were encountered: