Docker "label" functionality to limit containers seen in Pangolin UI#61
Closed
JonnyBooker wants to merge 13 commits intofosrl:devfrom
Closed
Docker "label" functionality to limit containers seen in Pangolin UI#61JonnyBooker wants to merge 13 commits intofosrl:devfrom
JonnyBooker wants to merge 13 commits intofosrl:devfrom
Conversation
Docker socket integration & Go Updates
Make Docker Socket Opt-In and Add Version Printout
Update Nix flake for 1.2.1
- Add new env setting for label enable - Added output for settings that are set against env variables
Contributor
Author
|
Apologies, targetting the branch incorrectly to begin with, updated now |
Contributor
Author
|
Closing this PR after discussion on discord in favour of other functionality to control container access in Pangolin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Community Contribution License Agreement
By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.
Description
I wanted the ability to be able to limit which containers pangolin can see. I have containers locally that I would not want to expose and seeing them in a list amongst containers that I did felt redundant and I didn't want to give the option in the UI.
Similar to traefik/watchtower, I have added functionality where if a new environment variable is set
DOCKER_LABEL_ENABLEto the value oftrue, that any container without a dedicated new label ofnewt.docker.enable=true, would be ignored and not sent to pangolin. Default not setting of this variable would keep existing behaviour.This does not disable access to the container itself, more disables it from being shown in pangolin, it could still be connected to if you knew the IP address. Therefore if a different name would be preferred, then that would be fine. I was following in the footsteps of other apps. Could have the potential that could call list containers once more to get the enabled one, matching up the IP address of the target against docker containers that are label enabled and reject connecting up this server? Open to suggestions on that one if should that.
I have also made it output the values of the variables being used if the log level is lowered to
DEBUGso you can verify you are seeing the values you expect.I haven't got any experience before today in Go so any conventions/formatting/aspects you would like me to change, I'm completely open. I just wanted to see if could make it happen and offer the option if people wanted it.
How to test?
docker build . -t newt:testHere is an example
docker-compose.ymlIn pangolin, only one container should be visible via the dashboard:

Logs will be visible if using a debug log level saying what is and isn't included:

Output of the debug logs for env variables:
