- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图充分了解 docker 的功能,以便对我安全地使用它产生合理的信心。对此的一个建议是始终使用 USER
Dockerfile 中的语句。在试图理解这一点的影响时,我遇到了一些麻烦。
具体问题:
testuser
但不允许 ls
什么时候在目录? testuser
? FROM alpine@sha256:1354db23ff5478120c980eca1611a51c9f2b88b61f24283ee8200bf9a54f2e5c
LABEL version 2.0
LABEL description "Test image for setting user"
RUN adduser -D testuser1 ## sometimes removed
RUN adduser -D testuser2 ## sometimes removed
RUN adduser -D testuser
USER testuser
CMD sh
docker build -t kasterma/testuser:1 .
docker run -ti -v /home/kasterma/test-user/:/test-home kasterma/testuser:1
/home/kasterma/test-user/
是包含 Dockerfile 的目录。
##sometimes removed
的两行在 Dockerfile 中。
[root@datalocal01 test-user]# docker run -ti -v /home/kasterma/test-user/:/test-home kasterma/testuser:1
/ $ ls -lh
...
drwx------ 2 1001 1001 40 Dec 30 14:08 test-home
...
kasterma
的用户和组ID在主机。在这种情况下
testuser
有 uid 和 gid 1000。
/ $ cd test-home
sh: cd: can't cd to test-home
##sometimes removed
的第二行在 Dockerfile 中。
/ $ ls -lh
...
drwx------ 2 testuser testuser 40 Dec 30 14:12 test-home
...
/ $ cd test-home
/test-home $ ls
ls: can't open '.': Permission denied
testuser
和
kasterma
具有相同的 uid 和 gid(尽管一个在容器中,另一个在主机上)。为什么我可以
cd
,但不是
ls
?
##sometimes removed
的任何一行在 Dockerfile 中。
/ $ ls -lh
...
drwx------ 2 testuser testuser 40 Dec 30 14:15 test-home
...
/ $ cd test-home
sh: cd: can't cd to test-home
testuser
uid 和 gid 为 1002,所以与
kasterma
不同.但 list 显示它为 testuser,但
cd
命令失败。
[root@datalocal01 test-user]# uname -a
Linux datalocal01 3.10.0-514.2.2.el7.x86_64 #1 SMP Tue Dec 6 23:06:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@datalocal01 test-user]# docker version
Client:
Version: 1.10.3
API version: 1.22
Package version: docker-common-1.10.3-59.el7.centos.x86_64
Go version: go1.6.3
Git commit: 3999ccb-unsupported
Built: Thu Dec 15 17:24:43 2016
OS/Arch: linux/amd64
Server:
Version: 1.10.3
API version: 1.22
Package version: docker-common-1.10.3-59.el7.centos.x86_64
Go version: go1.6.3
Git commit: 3999ccb-unsupported
Built: Thu Dec 15 17:24:43 2016
OS/Arch: linux/amd64
最佳答案
当主机运行 SELinux 时,如果没有标记,您可能无法访问文件系统内容。
来自 人 docker-run
Labeling systems like SELinux require that proper labels are placed on volume content mounted into a container. Without a label, the security system might prevent the processes running inside the container from using the content. By default, Docker does not change the labels set by the OS. To change a label in the container context, you can add either of two suffixes :z or :Z to the volume mount. These suffixes tell Docker to relabel file objects on the shared volumes. The z option tells Docker that two containers share the volume content. As a result, Docker labels the content with a shared content label. Shared volume labels allow all containers to read/write content. The Z option tells Docker to label the content with a private unshared label. Only the current container can use a private volume.
docker run -ti -v /home/kasterma/test-user/:/test-home:Z kasterma/testuser:1
关于Docker 用户进出容器 : what is the correspondence (UID/GID), 看到我不明白的效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41397809/
如果满足条件,我如何才能只获取特定记录? 我有代码为 "SELECT a.id, a.text, a.uid, a.time FROM story a INNER JOIN friends b
每当我尝试提取用户的 uid 时,它都会给我电子邮件。有谁知道为什么? var user = firebase.auth().currentUser; if (user != null
我正在为自己的业务编写一个简单的客户数据库(新娘礼服),并尝试实现以下目标: 我尝试过滤掉那些没有“ordered = 1”标志的uid。因此,不应显示来自用户的所有条目,其中至少一个条目具有“ord
我有一张表,UID 是主键。在旧系统中,它不是主键。因此,人们可以向该字段插入数据,但我们不想再这样做了。 在这个表中,我在 UID 2000 和 2005 之间有一个差距(2003 被占用)。我如何
我刚开始使用 Firebase(我正在使用react-redux-firebase,但不确定这是否与这个问题相关)。我在使用这些标准身份验证规则时遇到问题: { "rules": {
警告:我对一般编码和 xcode 非常陌生 运行 Xcode 8.2 无论如何,我已经保存了我的用户身份验证详细信息、电子邮件密码。我将它们保存在 user/currentUser.UID 下,它提供
有人知道吗,如果我从我的应用程序启动 android web-view 窗口,它是否与启动它的应用程序具有相同的 UID。我正在使用三星手机,我认为他们使用的是 Web-Kit 浏览器,但我也想知道使
我有一个正在注册用户的注册表单,如果注册完成,应该重定向到index.html(主页)。 问题:按下提交按钮后,页面刷新并且表单获取重置,不会重定向,除非我按 CTRL + SHIFT + R 然后将
这个问题在这里已经有了答案: SecurityException: caller uid XXXX is different than the authenticator's uid (17 个答案
我正在尝试构建一个基于 PHP 的 Web 软件,但我遇到了一个我不知道解决方案语法的问题。 基本上,我有两个表: +-------------+ +---------------+ | Ce
我有一个 Firebase 表,其中包含任务列表。 任务有一个名为 uid 的字段。 我想获取我传入的 uid == uid 的所有任务。 最佳答案 Firebase 允许您对一组数据进行排序和过滤。
这是一个 set-root-uid 程序 $ls -l -rwsr-sr-x 1 root root 7406 2011-12-13 22:37 ./x* 源代码: int main(void) {
我在 OSX 上使用 emacs 24.5.1 和 mu4e 和 mbsync。我正在与 imac 和笔记本电脑同步,所以可能与前面提到的错误相同 here ,但没有人发布解决方案。 我的具体错误是在
我注意到 access(2) 系统调用使用真实且无效的用户 ID 进行访问控制检查的困难之处。虽然这与 Linux 上的 access(2) 手册页所说的一致,但对我来说仍然没有什么意义......
我需要帮助来了解如何创建数据库系统,以便每个用户都有自己的数据,我想确保当我从我的站点发送数据时,它是用这个顺序保存的(集合名称)/(创建该数据的用户的 uid)/(名称由日期创建的文档#this 我
假设我有一个独特的 VarChar(32) 列。 例如。 13bfa574e23848b68f1b7b5ff6d794e1。 我想在将列转换为 int 时保留它的唯一性。我想我可以将所有字母转换为它们
我想弄清楚如何将我的“数据”数组中的 Firebase UID 字符串与我从 firebase 调用中提取的键相匹配。我需要将“数据”数组中的字符串与“键”相匹配,然后我就可以按我想要的方式操作数据。
如果我使用 imaplib 在收件箱中有此邮件的 UID,如何获取所有 Maill 文件夹中邮件的 UID?如您所知,所有邮件和收件箱中的两个实例中的谷歌商店邮件我想使用 imaplib 将其移动到垃
我正在制作一个控制电话网络状态的应用(在 2G/3G 之间切换)。 出于某种原因,我的应用程序使用 sharedUserId="android.uid.system",但在 Phone 上下文下运行(
我在尝试实现 Sample Sync Adapter 应用程序时收到上述异常。我看过很多与此问题相关的帖子,但没有令人满意的回复。 所以我会记下my solution在这里以防其他人遇到同样的问题。
我是一名优秀的程序员,十分优秀!