-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
v2.3.x config yaml output contains ports as strings #9306
Comments
This has broken our build system. We run:
Our docker desktop version:
|
Docker compose is now on version 2.4.1, and Docker Desktop at 4.7.1 I am stuck at holding docker desktop at v4.5.0 to prevent this from happening. I'm not complaining but would love to know if there's any idea on when this will be addressed? |
I thinking it may be best to use |
FYI This is my script to get a swarm compatible compose file from a "docker compose config" It is now in production and working with latest docker compose (2.6.0)
The reparecompose.js :
It does only 3 changes in the file. |
This is really annoying. Any clean fix available or must I use an older version? |
How do we get this to be a priority for the docker dev team? I upgraded today to 4.11.1 and it is still an issue, so again, reverting to 4.5.0. I'm getting closer and closer to giving up with Docker. |
Hey 👋
Docker Compose and Stack have 2 different purposes and should not be use together, even if they have been sharing the same file format at one point. |
@designermonkey, @danielporto i provided a script in this thread to "make docker config great again" The other viable way is to set your env from your .env file before deploying.
|
Being a simple end user, I didn't know that different aspects of the same bundled software are owned by different people. Thanks @glours for letting us know that.
I can't agree with this however as up until very recently they were completely compatible and just ignored each other's differences. It's very stressful to be using what people consider a single application 'docker' in production and it not even be compatible with itself. Also, thanks @rafipiccolo I will have to investigate that idea more. |
Hey @glours, thanks for your reply.
I don't use swarm. The issue happens with
I find this a bit confusing. This specification doesn't say anything about the type of If current one is the expected behaviour, I think there are still some inconsistencies:
Using port ranges would be a reason to use strings instead of numbers, but in this case
|
I want to throw another one in as it's technically the same issue:
Again it's a swarm specific property yet compose breaks it and converts If these properties aren't part of the compose spec and compose doesn't care about them, surely leaving them well alone would be best practice? |
Compose specification says:
While arguably poorly documented, this means published can be set by
Need to double check then, that's weird |
@jsoriano I just tested with your output, and I can't reproduce the problem with Compose > bat compose.yaml
───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: compose.yaml
│ Size: 212 B
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ services:
2 │ test:
3 │ image: nginx
4 │ ports:
5 │ - mode: ingress
6 │ target: 8080
7 │ published: "8080"
8 │ protocol: tcp
9 │ - mode: ingress
10 │ target: 8081
11 │ published: "8081"
12 │ protocol: tcp
───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
> docker compose up -d
[+] Running 1/1
⠿ Container issue-9306-test-1 Started 0.2s
> docker compose ps
NAME COMMAND SERVICE STATUS PORTS
issue-9306-test-1 "/docker-entrypoint.…" test running 80/tcp, 0.0.0.0:8080-8081->8080-8081/tcp
> docker compose version
Docker Compose version v2.9.0 |
|
@jsoriano I just opened 2 PRs to update both Docker documentation and the Compose specification Anyway I'm not sure to understand your issue. |
My issue was that the format of In our case we parse the output of |
Ok it's clear now, sorry for the inconvenience 😞 I don't try to find excuses, we mess up in our communication in that case. |
Yep, at this point the best is to support both formats. Thanks for updating the docs! |
For those that need to translate variables and don't want to use the translation with the node script suggested by @rafipiccolo nor copy it to a .env file, a simple "sed" script does the job: Then I can come back using the newer docker version while this issue gets properly fixed. To feed docker stack command: |
@danielporto's
However, it exposed the next problem, where the
Putting it all together in one command:
|
If any (like me) has the same problem: while the |
I tried it. and it's not a drop in replacement for docker compose config. (although it may solve some bugs like ports format)
Docker Compose version v2.20.3 |
My bad, you're absolutely correct: |
FWIW docker seems to believe that the real solution is to source .env in the real env when you do this can get rid completely of "docker compose config" / "docker stack config". |
The then the following would be our command:
Question: is |
Nope, |
using
|
Description
docker-compose config
formats thepublished
port as a string, this can be a problem when parsing this output.This starts to happen in 2.3.0.
In documentation ports appear as numbers.
Steps to reproduce the issue:
docker-compose config
.published
port is a string, whiletarget
port is a number.Can be reproduced for example with this minimal
docker-compose.yml
:Describe the results you received:
Describe the results you expected:
Additional information you deem important (e.g. issue happens only occasionally):
It seems to happen since
2.3.0
, in2.2.3
the result is the expected one.Output of
docker compose version
:Output of
docker info
:Additional environment details:
The text was updated successfully, but these errors were encountered: