Skip to content
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

Commented out lines in compose file disappear when starting/deploying container. #176

Open
2 tasks done
JohnDoe-dev-spec opened this issue Nov 24, 2023 · 12 comments · May be fixed by #685
Open
2 tasks done

Commented out lines in compose file disappear when starting/deploying container. #176

JohnDoe-dev-spec opened this issue Nov 24, 2023 · 12 comments · May be fixed by #685
Labels
bug Something isn't working need-reproduce-steps

Comments

@JohnDoe-dev-spec
Copy link

⚠️ Please verify that this bug has NOT been reported before.

  • I checked and didn't find similar issue

🛡️ Security Policy

Description

I have created a new stack with Dockge and commented out some lines in the YAML with #

I then start/deploy the stack and it creates successfully and refreshed the page. The compose.yaml no longer shows me the commented out line, it disappears.

I then login to the host and nano compose.yaml and i can see the commented out line there but not in Dockge.

👟 Reproduction steps

Create stack and comment out line
Deploy/start stack
Refresh Page

Line disappears

👀 Expected behavior

The commented out line still to appear in my compose.yaml so i can reintroduce it if i want to.

😓 Actual Behavior

Commented out line disappears from Dockge GUI

Dockge Version

1.1.1.1

💻 Operating System and Arch

DietPI Debian

🌐 Browser

Firefox/Chrome

🐋 Docker Version

Docker 24.0.7

🟩 NodeJS Version

N/A

📝 Relevant log output

No response

@JohnDoe-dev-spec JohnDoe-dev-spec added the bug Something isn't working label Nov 24, 2023
@cirrusflyer
Copy link

Noticed this too.

@louislam
Copy link
Owner

louislam commented Nov 25, 2023

Need an example, I cannot reproduce. Still there after refresh.

image

@JohnDoe-dev-spec
Copy link
Author

I can't seem to reproduce it either anymore.

It did disappear!

Close this off for now and if it happens again i will re-open with example.

Thanks!

@marvint24
Copy link

It's seams like that this is still an issue.
Steps to reproduce:

  • Create a new compose
  • Paste:
version: "3.8"
services:
  nginxpm:
    image: jc21/nginx-proxy-manager:latest
    ports:
      - 80:80
      # test comment
      - 443:443
    volumes:
      - nginx_data:/data
      - nginx_letsencrypt:/etc/letsencrypt
    restart: unless-stopped
volumes:
  nginx_data: 
  nginx_letsencrypt: 
  • Save
  • Edit

@andzno1
Copy link

andzno1 commented Mar 15, 2024

I can confirm that it's still happening. The lines disappear as soon as you start editing the stack.

Edit to say that only certain comments will disappear, as the one provided in this comment. Commenting out the whole ports entry will not be affected.

@mikansontap123
Copy link

@louislam Can we re-open this issue please? The steps given by @marvint24 also are reproduceable on my end.

@louislam louislam reopened this May 19, 2024
@bpbradley
Copy link

Happens reliably when commenting out a label.

@Robonau
Copy link

Robonau commented Aug 10, 2024

was looking in to this because its really annoying.
it happens on this parseDocument function call

let doc = parseDocument(yaml);

it can deal with comments at the start and end of an array but not in the middle
so

label:
  # comment at start of object
  - label.on.container=true
  # comment at middle of object
  - label.on.container2=false
  # comment at end of object

would remove the middle comment but the start and end ones would stay leading to the front-end displaying

label:
  # comment at start of object
  - label.on.container=true
  - label.on.container2=false
  # comment at end of object

to be clear the comment is actually there in the file until you save/deploy it again after editing
its just failing at the yaml > object step to making it editable in the browser

@Robonau
Copy link

Robonau commented Aug 11, 2024

a work around for now is to do like so

labels:
  # comment at start of object
  - label.on.container=true
  - a # comment at middle of object
  - label.on.container2=false
  - b # comment at middle2 of object
  - c # comment at middle3 of object
  - d # comment at middle4 of object
  - label.on.container3=false
  # comment at end of object

this should work fine for both labels and environment as the a,b,c,d values are just ignored if they are not used

@shalafi99
Copy link

shalafi99 commented Aug 30, 2024

I can confirm the workaround @Robonau suggested, lines which are only a comment get removed when you edit the compose.
except if they are placed right below a section start or right at its end.

And comments placed to the right of a compose parameter are left untouched.

Also, upon editing the template the comments which do not get removed have their indentation changed like so (probably by design, but as they being comments I did not expect it to happen):

An saved example compose excerpt:

volumes: # to the right of section name
# at beginning of section
- ./data:/data
# at end of section

When I edit it:

volumes:
# to the right of section name (moved down and got indented to align with the existing parameter)
# at beginning of section (indented to align with the existing parameter )
- ./data:/data
# at end of section (indented to align with the section title)

@frostronic
Copy link

Bumping this issue, it's definitely something I've been dealing with for many months. I've started editing most of my compose files manually via terminal so Dockge doesn't remove the comment lines leading with (#). Interestingly, after I edit the files manually, Dockge refuses to show many of the comments.

@turnah
Copy link

turnah commented Dec 10, 2024

I've added a PR which hopefully sorts this issue out, as i lost quite a bit of work from my Traefik labels when i was commenting things out (trial and error) to see what was killing one of my dockers when setting up Keycloak.

Either way, thanks for a fantastic app, I've completely moved away from Portainer now for my homelab and VPS as this is exactly what i wanted in a product; saving the endless docker compose down && docker compose up -d's when developing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need-reproduce-steps
Projects
None yet
Development

Successfully merging a pull request may close this issue.