wodby / drupal-php

PHP docker container image for Drupal
https://wodby.com/stacks/drupal
MIT License
60 stars 80 forks source link

sudo password for user wodby #67

Closed sprklinginfo closed 5 years ago

sprklinginfo commented 5 years ago

Hi there, If I docker-compose exec php sh into the php container, I access the container as the user wodby. How can I become root user? I tried with sudo su - but don't know the sudo password for this user. Thanks,

csandanov commented 5 years ago

Use dev version of the image:

$ docker run --rm -ti wodby/drupal-php:dev sh                                                                                                  
wodby@php.container:/var/www/html $ sudo su
root@php.container:/var/www/html $
davidwhthomas commented 4 years ago

Hi @csandanov sorry to comment on a closed issue, but is there anyway to reset or set the wodby sudo/root password when not using the dev image?

Update:

One way to set it is, to enter the container as root and set it with passwd

docker exec -it -u root $container bash
passwd wodby

There's also some configuration available for the wodby user allowed commands in

/etc/sudoers.d/wodby

That can be updated via updating that file, e.g transfer custom file from host.

However, could be nice to have another way to set the password as part of build.

Update 2:

It looks ok to transfer the sudoers.d/wodby file to the image to allow running other commands as sudo (without password)

Example Dockerfile entry

# Copy sudo config for wodby user
COPY ./docker/etc/sudoers.d /etc/sudoers.d

All good for now, thanks.

superromeo commented 3 years ago

Use dev version of the image:

$ docker run --rm -ti wodby/drupal-php:dev sh                                                                                                  
wodby@php.container:/var/www/html $ sudo su
root@php.container:/var/www/html $

Sorry, but I think it's inconvenient. Maybe is there another way? Just use wodby password?

autn commented 3 years ago

+1, I also need the wodby password for "no-dev" version.

superromeo commented 2 years ago

What I should change in my .env or docker-compose.yml files to use dev version of the image?