Bitbucket管道:作为非根管运行

发布于 2025-01-23 07:32:49 字数 1191 浏览 2 评论 0原文

我的Bitbucket部署管道中的一个步骤之一是执行

- step:
    name: Start MaintenanceMode
    script:
      - php bin/wp-cli.phar mm_enter --ssh=[...]

,但是,可以理解的是,wp_cli.phar不喜欢作为root运行。我可以通过使用- allow-root来摆脱错误,但是我宁愿根本不以root的步骤运行任何内容。有什么方法可以在没有根特权的情况下在Bitbucket管道中运行一步?

我已经看过这个类似的问题,但这似乎只是因为节点创建新用户而起作用。

这是线的特定输出

Error: YIKES! It looks like you're running this as root. You probably meant to run this as the user that your WordPress installation exists under.
If you REALLY mean to run this as root, we won't stop you, but just bear in mind that any code on this site will then have full control of your server, making it quite DANGEROUS.
If you'd like to continue as root, please run this again, adding this flag:  --allow-root
If you'd like to run it as the user that this site is under, you can run the following to become the respective user:
    sudo -u USER -i -- wp <command>

One of my steps in my Bitbucket deployment pipeline involves executing

- step:
    name: Start MaintenanceMode
    script:
      - php bin/wp-cli.phar mm_enter --ssh=[...]

However, understandably wp_cli.phar doesn't love being run as root. I can get rid of the error by using --allow-root, but I would prefer to simply not run anything in the step as root. Is there any way to run a step in a Bitbucket pipeline without root privileges?

I've looked at this similar question but that seems to only work because node creates a new user.

Here is the specific output from the line

Error: YIKES! It looks like you're running this as root. You probably meant to run this as the user that your WordPress installation exists under.
If you REALLY mean to run this as root, we won't stop you, but just bear in mind that any code on this site will then have full control of your server, making it quite DANGEROUS.
If you'd like to continue as root, please run this again, adding this flag:  --allow-root
If you'd like to run it as the user that this site is under, you can run the following to become the respective user:
    sudo -u USER -i -- wp <command>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

太傻旳人生 2025-01-30 07:32:49

您有几个解决方案

  1. 检查容器中可用用户的列表 - 您的大多数容器已经有一个用户

  2. 构建无根特权的容器的阶段为自己创建新用户

You have several solutions

  1. Check the list of available users in the container - most of all your container already has a user

  2. Create a new user for yourself at the stage of building a container without root privileges

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文