Giter VIP home page Giter VIP logo

Comments (7)

samdark avatar samdark commented on July 16, 2024

Good idea. @schmunk42 what do you think?

from yii2-docker.

schmunk42 avatar schmunk42 commented on July 16, 2024

Basically yes, if it is intuitive. One reason there's nothing by default was related to Alpine, which has no usermod by default so you can't really switch the user.

From my experience, I find it OK to be root when I run exec bash, since there's hardly anything I want to do as an unprivileged user here. Examples welcome.

While our app (when running yii) usually runs as the same user as the webserver, ie. to prevent permission issues for directories, etc... when I need to run this "as root" I usually prepend PHP_USER_ID=0 yii to the command (which could also be aliased as suyii).

from yii2-docker.

danjudex avatar danjudex commented on July 16, 2024

why not install the package usermod in image for compatibility?

RUN echo http://dl-2.alpinelinux.org/alpine/edge/community/ >> /etc/apk/repositories
RUN apk --no-cache add shadow

from yii2-docker.

schmunk42 avatar schmunk42 commented on July 16, 2024

why not install the package usermod in image for compatibility?

Last time I tried this it required several hundred megabytes of additional packgages.

Moreover Alpine has highly esoteric issues, see also https://github.com/docker-library/docs/blob/master/php/README.md#phpalpine

from yii2-docker.

danjudex avatar danjudex commented on July 16, 2024

docker image ls

alpine-usermod        latest              95405d664f72        4 minutes ago       6.13MB
alpine                latest              3fd9065eaf02        5 months ago        4.15MB

Dockerfile

FROM alpine

RUN echo http://dl-2.alpinelinux.org/alpine/edge/community/ >> /etc/apk/repositories
RUN apk --no-cache add shadow

from yii2-docker.

schmunk42 avatar schmunk42 commented on July 16, 2024

It's good if it is so easy now, but it's not planned to support Alpine anyway.

from yii2-docker.

schmunk42 avatar schmunk42 commented on July 16, 2024

You can do this with Debian images like so:

docker-compose exec -u www-data php bash
www-data@bffa62a55ea8:/app$ whoami
www-data

from yii2-docker.

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.