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

Run Docker container with a specific user #5556

Closed
wants to merge 3 commits into from

Commits on May 17, 2019

  1. Run Docker container with a specific user.

    Pass --user (`DOCKER_USER`) attribute when creating the container.
    
    This has no effect in production since we are using the same user and
    group than the one defined inside the Dockerfile image (docs:docs).
    Although, this allow us to avoid permissions conflicts when running
    the build with Docker locally (development) since we can pass our
    current user.
    
    That way, every file created/modified inside the container will be
    done using the current UID and GID defined by the developer.
    
    This can be done as,
    
    local_settings.py
    DOCKER_USER = f'{os.geteuid()}:{os.getegid()}'
    
    With this change, there is no need to re-build the Docker image used
    in production with our own custom `USER` instruction.
    
    https://docs.docker.com/engine/reference/run/#user
    
    Co-authored-by: Raúl Cumplido <raulcumplido@gmail.com>
    humitos and raulcd committed May 17, 2019
    Configuration menu
    Copy the full SHA
    09b985c View commit details
    Browse the repository at this point in the history
  2. Better default for DOCKER_USER

    This default value will make docker build image to work without worrying about user permissions.
    humitos committed May 17, 2019
    Configuration menu
    Copy the full SHA
    7d735f6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    52ab399 View commit details
    Browse the repository at this point in the history