GithubHelp home page GithubHelp logo

User Level Permissions by Default? about dip HOT 1 CLOSED

erwin avatar erwin commented on July 4, 2024
User Level Permissions by Default?

from dip.

Comments (1)

bibendi avatar bibendi commented on July 4, 2024 1

Hi @erwin
I'm so sorry for the long response. It looks like I missed your issue.

I like your proposal. It seems we can pass a --user option https://docs.docker.com/engine/reference/commandline/compose_run/

So we can try to implement something like the following:

# dip.yml

interaction:
  cmd:
    service: backend
    command: foo
    run_as_me: true

where run_as_me will be converted into docker compose run --user $(id -u):$(id -g)

We should be careful because I don't have the problem with permissions on Docker for Mac, so maybe we should skip this option.

Update: after writing the text above, I realized that it won't work with dip compose up some-service.
I found an interesting post https://medium.com/redbubble/running-a-docker-container-as-a-non-root-user-7d2e00f8ee15

So, we can add a separate docker-compose.linux.yml https://github.com/bibendi/dip#dip_os with:

services:
  app:
    user: ${DIP_CURRENT_USER}

add it to a dip.yml

compose:
  files:
    - docker-compose.yml
    - docker-compose.${DIP_OS}.yml

and implement DIP_CURRENT_USER here

def special_vars
@special_vars ||= SPECIAL_VARS.each_with_object({}) do |key, memo|
memo["DIP_#{key.to_s.upcase}"] = "find_#{key}"
end
end

or you can add it to your ~/.zshrc

DIP_CURRENT_USER=$(id -u):$(id -g)

from dip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.