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

Restrict To Specific Containers #83

Closed
adamzero1 opened this issue Jul 21, 2019 · 12 comments
Closed

Restrict To Specific Containers #83

adamzero1 opened this issue Jul 21, 2019 · 12 comments
Labels
enhancement New feature or request

Comments

@adamzero1
Copy link

I'm wondering if it would be possible to restrict the list of availble containers?
E.g 1 host with 2 projects, would be good if you could restict to only show containers from 1 project

@amir20
Copy link
Owner

amir20 commented Jul 21, 2019

Hmm...It's not possible right now. But I could add it. What's your use case? Is it that important to hide other containers for you?

@adamzero1
Copy link
Author

Thanks for getting back so quick!
I was hoping to use/include this with mdoq the premise being there could be multiple projects on a single server. With the app mounting the docker.sock it can obviously see everything. Which is not ideal, as we need to keep seperation between projects.
It's something I'm happy to add and create a PR for, if you could provide some build steps so I can test locally before creating the PR?

@amir20
Copy link
Owner

amir20 commented Jul 21, 2019

Nice. That would be a good addition to mdoq.

It would be really nice to get a PR. I am really busy at work so won't have much time to work on this until next week. But I can review and merge.

Here are some things that might get you going with building Dozzle:

  1. Install nodejs v12
  2. Install go v1.12.7
  3. Install packr globally by doing go get -u github.com/gobuffalo/packr/packr outside for dozzle
  4. npm i to install node mods
  5. You can look at the automated build file script to understand how I build everything.
  6. npm start should automatically do go mod download and start dozzle at port localhost:8080

Here is what you would need to change:

  1. Add a new string flag that can be configure the regex (or whatever you decide to do) at https://github.com/amir20/dozzle/blob/master/main.go#L38
  2. Possibly add the logic at https://github.com/amir20/dozzle/blob/master/main.go#L135 to filter based on the flag.
  3. If it's important, then you would need to also update https://github.com/amir20/dozzle/blob/master/main.go#L148 to not allow logs of filtered docker images

I hope this helps. Let me know if you have any questions.

@amir20 amir20 added the enhancement New feature or request label Jul 21, 2019
@adamzero1
Copy link
Author

Nice one, PR raised

@amir20
Copy link
Owner

amir20 commented Jul 22, 2019

Should be fixed in #85

@amir20
Copy link
Owner

amir20 commented Jul 22, 2019

@adamzero1 Released v1.12 can you try it out?

@adamzero1
Copy link
Author

@amir20 looks to be working

version: "3"
services:
  dozzle:
    container_name: dozzle
    image: amir20/dozzle:latest
    environment:
      - DOZZLE_CONTAINERRESTRICTIONS=6893-.*
      - DOZZLE_TAILSIZE=100
      - DOZZLE_FILTERNAME=6893-.*
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - 9999:8080

Only issue is we have now lost the ability to pass in any other kind of filter. We are forced to filter on name. I had thought you wanted it more generic. where you could pass in something like:

DOZZLE_FILTERNAME=name=6893-.*

It still works for what I need though, nice one!

@amir20
Copy link
Owner

amir20 commented Jul 23, 2019

Ah I see. Did you have that in your PR? I may have not pulled the latest. Sorry if I missed it. I looked at the filters and it seemed like name would be the most common since it won't change.

On a plus a side, you don't need *. You should just be able to do foo which will work just like .*foo.*. That was the nice part of using the docker API directly.

@amir20
Copy link
Owner

amir20 commented Jul 23, 2019

I now see https://github.com/amir20/dozzle/pull/84/files#diff-210c31cd49f34ac9a1fcc99dd77d9030R48. Maybe it makes sense to add that back? I like that you can also filter based on labels. Which will probably make a lot of sense for people.

@amir20
Copy link
Owner

amir20 commented Jul 24, 2019

@adamzero1 I added this back in #87.

@amir20 amir20 closed this as completed Jul 24, 2019
@adamzero1
Copy link
Author

Sorry have had a hectic few days, yeah opening up so it wasn't name filter specific would be better overall I feel.

@amir20
Copy link
Owner

amir20 commented Jul 25, 2019

No worries. Sounds good. The feature should be deployed now. Thanks for your help and PR. It was an interesting feature I hadn't thought of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants