我有一个非 root 用户运行的 docker 容器以提高安全性,但它似乎无法访问我与之共享的秘密:
Importing account from "/run/secrets/authority.priv.json" failed: Permission denied (os error 13)
Run Code Online (Sandbox Code Playgroud)
我在我的 docker compose 中尝试了不同的解决方案:1. 将 uid 和 gid 设置为 1000(如果用户在容器内,则设置为 uid/gid) 2. 将模式设置为 0444 甚至 0777
但是这些都没有奏效,只有使用 root 才能使用这些秘密。
任何的想法?
额外的问题:在 kubernetes 中会出现同样的问题吗?
码头档案:
FROM parity/parity:v2.2.1
LABEL maintainer="vincent@serpoul.com"
# SAD but It seems impossible to read the secrets otherwise
USER root
VOLUME ["/home/parity/.local/share/io.parity.ethereum"]
ADD ./configPoANode.toml /home/parity/configPoANode.toml
ADD ./PoA.json /home/parity/PoA.json
ADD ./entrypoint.sh /home/parity/entrypoint.sh
ENTRYPOINT ["/home/parity/entrypoint.sh"]
Run Code Online (Sandbox Code Playgroud)
附录:存储库(dockerfile 中有用户 ROOT):
我是 docker 的新用户,即将在生产环境中从虚拟机迁移到容器。但后来,我突然意识到,最适合我的开发和质量保证环境的东西对于生产来说并不理想。
在我的 dev 和 qa 中,我将版本化项目文件夹安装到 python/php(命名它)容器中,并且我将此容器视为我的代码的“运行服务”。这使我不必拥有巨大的容器,因为当我更改代码(git commit 或其他)时,容器历史记录不会更改。
在生产中,理想的情况是我将拥有干净的独立容器,其中包含我的代码,而不是像在开发中那样安装。
那么,我是不是理解错了?你怎么做呢?从开发到生产您使用相同的容器吗?
我刚刚提出了一个指令,根据来自API调用($ resource)的列表加载一个下拉框.
控制器:
App.controller(
'TestCtrl', [
'$scope', 'countriesFactory',
function($scope, countriesFactory){
/* Call API */
countriesFactory().then(function(data){
$scope.countryList = data;
});
}])
Run Code Online (Sandbox Code Playgroud)
API调用返回:
{"country":[{"code":"ABW","label":"Aruba"},{"code":"AFG","label":"Afghanistan"},{"code":"AGO","label":"Angola"}]}
Run Code Online (Sandbox Code Playgroud)
模板:
<input-select model-ref-list="countryList"></input-select>
Run Code Online (Sandbox Code Playgroud)
指示:
App
.directive("inputSelect"
, function() {
var Template =
'<select ng-options="item.label for item in modelRefList" required></select>';
return {
restrict: 'EA',
template: Template,
scope: {
modelRefList: '='
},
link: function(scope){
console.log(scope.modelRefList);
}
};
}
);
Run Code Online (Sandbox Code Playgroud)
首先:我简化了很多整体问题,因此看起来该指令在这种情况下完全矫枉过正,但最终却不是:D.
问题:我的console.log始终未定义.
我做了一些研究,并意识到我需要玩承诺等待我的国家名单似乎实际上给了指令.所以我尝试修改我的控制器而不是使用API调用promise的结果,而是直接使用资源本身:
新控制器:
App.controller(
'TestCtrl', [
'$scope', 'countriesFactory',
function($scope, countriesFactory){
/* Call API */
$scope.countryList = resourceAPICall();
}])
Run Code Online (Sandbox Code Playgroud)
但仍未定义:/.
我怎样才能将direclty资源(包含我可以用来推迟select的加载的承诺)传递给指令? …
这是我的两个单位:
- name: percona_db.service
command: start
enable: true
content: |
[Unit]
Description=Percona db
After=docker.service
Requires=docker.service
[Service]
ExecStartPre=/bin/bash -c '/usr/bin/docker start -a mysql_datastore || /usr/bin/docker run -d -v /var/lib/mysql --name mysql_datastore -p 23:23 busybox'
ExecStart=/bin/bash -c '/usr/bin/docker start -a mypercona || /usr/bin/docker run -i -t --volumes-from mysql_datastore --name="mypercona" -p 3306:3306 --rm percona'
ExecStop=/usr/bin/docker stop mypercona
[Install]
WantedBy=multi-user.target
- name: php_fpm.service
command: start
enable: true
content: |
[Unit]
Description=php fpm
After=percona_db.service
Requires=percona_db.service
[Service]
ExecStart=/bin/bash -c '/usr/bin/docker start -a myphpfpm_53 || /usr/bin/docker run …Run Code Online (Sandbox Code Playgroud) 我最近在生产中推出了 gke 和 kubernetes。我有没有明显原因的定期中断。没有事件显示任何内容,pod 没有重新启动并且看起来很稳定。我有一个类似的 qa env,它完全没有问题,但它要小得多。
我在哪里可以找到有关中断原因的潜在信息?
为什么会出现这种恐慌?
pub fn testbool() -> bool {
vec!['a', 'd', 'i', 'e', 'p', 'r']
.iter()
.enumerate()
.find(|(_i, &c)| c != 'c')
.is_none()
}
#[test]
fn test_testbool() {
assert!(testbool(), true);
}
Run Code Online (Sandbox Code Playgroud)
pub fn testbool() -> bool {
vec!['a', 'd', 'i', 'e', 'p', 'r']
.iter()
.enumerate()
.find(|(_i, &c)| c != 'c')
.is_none()
}
#[test]
fn test_testbool() {
assert!(testbool(), true);
}
Run Code Online (Sandbox Code Playgroud)
这可能很简单,但我不明白。