【问题标题】:Docker Permissions: userid in container is different from userid on hostDocker 权限:容器中的用户标识与主机上的用户标识不同
【发布时间】:2023-01-24 14:20:53
【问题描述】:

我正在尝试安装 shopware(如此处https://github.com/shopware/platform)并使用 docker 运行。

尽管根据 /etc/passwd 文件,容器中的应用程序用户和我的主机用户的用户 ID 均为 1000,但我有权限问题。

根据ls -lan,用户标识在主机和容器中是不同的:

主持人:

runa@miriade:~/Code/Shopware $ ls -lan
...
-rw-r--r--  1   1000   1000       0 Okt 11 19:35 file_docker_root
-rw-r--r--  1      0      0       0 Okt 11 19:36 file_host_sudo
-rw-rw-r--  1   1000   1000       0 Okt 11 19:35 file_host_user
...

容器:

root@2dee62c9d009:/app# ls -lan
...
-rw-r--r--  1     0     0       0 Oct 11 17:35 file_docker_root
-rw-r--r--  1 65534 65534       0 Oct 11 17:36 file_host_sudo
-rw-rw-r--  1     0     0       0 Oct 11 17:35 file_host_user
...

有几个文件用用户 ID 做事,我试着修改它们,但无法得到任何关于出了什么问题的提示:

docker-compose.override.yaml

...
services:
  shopware:
    image: shopware/development:local
    build:
      context: dev-ops/docker/containers/app
      args:
        USER_ID: 1000
        GROUP_ID: 1000
        IMAGE_PHP: webdevops/php-apache
        IMAGE_PHP_VERSION: 7.4

    volumes:
      - .:/app
      - ~/.npm:/.npm
    environment:
      CONTAINER_UID: 1000
      APPLICATION_UID: 1000
      APPLICATION_GID: 1000
...

docker-sync.yml

...
syncs:
  shopware:
    src: './'
    sync_excludes: ['.git', '.idea', 'dev-ops/docker/_volumes', 'var', '.docker-sync']
    sync_userid: $USER_ID   
    sync_groupid: $GROUP_ID
...

docker-desktop 在我的系统上以用户权限运行。

任何帮助,将不胜感激!

【问题讨论】:

标签: linux docker permissions user-permissions


【解决方案1】:

我面临着完全相同的问题。

如果我将容器上的授权更改为 www-data:www-data,则商店和安装工作。但是,之后我没有 IDE 或 git 的许可。

您是否同时解决了这个问题,如果解决了,是如何解决的?

谢谢!

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-04-27
  • 2018-11-11
  • 1970-01-01
  • 2015-11-11
  • 2014-03-29
  • 1970-01-01
  • 2013-06-16
相关资源
最近更新 更多