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

Allow Empty Label Values for Containers #2646

Closed
mcrosson opened this issue Jan 24, 2019 · 6 comments
Closed

Allow Empty Label Values for Containers #2646

mcrosson opened this issue Jan 24, 2019 · 6 comments

Comments

@mcrosson
Copy link
Contributor

Bug description

When deploying a container you cannot specify labels without an empty value. If you don't specify a value they are silently dropped from container creation and cannot be added via the web ui.

Expected behavior
Allow empty/null values for labels set on containers. This is valid per the docker spec and some utilities use labels with empty labels to help with auto-discovery

Steps to reproduce the issue:

Steps to reproduce the behavior:
Deploy a container with a label and no value specified

Technical details:

  • Portainer version: 1.20.0
  • Docker version (managed by Portainer):
    Docker version 18.09.0, build 4d60db4
  • Platform (windows/linux): linux
  • Command used to start Portainer (docker run -p 9000:9000 portainer/portainer):
    docker run
    --name portainer
    --restart unless-stopped
    --net docker-private
    --ip 172.30.30.30
    -p 9000:9000
    -e TZ=UTC
    -v /var/portainer:/data
    -v /var/run/docker.sock:/var/run/docker.sock
    portainer
  • Browser:

Additional context
Add any other context about the problem here.

@mcrosson
Copy link
Contributor Author

@deviantony If you'd like to point me in the right direction I can take a shot at a small code change + PR

@deviantony
Copy link
Member

@mcrosson
Copy link
Contributor Author

mcrosson commented Jan 25, 2019

@deviantony Quick question

Where is the underlying code for things like Container.get({ id: id }).$promise in docker/services/containerService.js I can't seem to connect one of the dots here.

Edit

Looks like api/http/proxy/response.go has extractJSONField and it's somehow eating empty labels.

If the jsonObject returned for a key is empty string will it be assigned nill instead of empty string?

@deviantony
Copy link
Member

Hi @mcrosson

Regarding your first question you can usually find these in the rest/ folder of the corresponding module.

Backend should not remove empty labels, I'll check that.

@mcrosson
Copy link
Contributor Author

@deviantony Thanks!

I did open a PR for the rest of the empty label updates for the container side. The only thing that I ran into is the extractJSONField bit during my testing. Outside of that the PR should be good to go.

@ghost ghost self-assigned this Apr 18, 2019
@deviantony deviantony added this to the next milestone Oct 14, 2019
@deviantony deviantony added priority/normal Core team priority priority/low Core team priority and removed priority/normal Core team priority labels Oct 18, 2019
@ghost ghost removed their assignment Oct 21, 2019
@deviantony deviantony removed this from the next milestone Oct 31, 2019
@deviantony deviantony added this to the next milestone Nov 25, 2019
@deviantony
Copy link
Member

Closed via #2655

@deviantony deviantony removed the priority/low Core team priority label Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants