有时在构建Docker镜像时需要使用敏感数据.例如,用于下载远程文件或从私有存储库安装依赖项的API令牌或SSH密钥.可能需要分发结果图像并省略用于构建它的敏感凭证.如何才能做到这一点?
我见过docker-squash,可以将多个图层压成一个,从最终图像中删除任何已删除的文件.但是有更惯用的方法吗?
我注意到Ansible使用分号删除临时脚本来分隔bash命令.
这是一个示例命令:
EXEC ssh -C -tt -v -o ControlMaster=auto -o ControlPersist=60s -o
ControlPath="/Users/devuser/.ansible/cp/ansible-ssh-%h-%p-%r" -o
KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o ConnectTimeout=10 build /bin/sh -c
'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python
/home/ec2-user/.ansible/tmp/ansible-tmp-1430847489.81-75617096172775/docker;
rm -rf
/home/ec2-user/.ansible/tmp/ansible-tmp-1430847489.81-75617096172775/
>/dev/null 2>&1'
Run Code Online (Sandbox Code Playgroud)
有没有办法告诉ansible用双符号替换分号或告诉它在运行ansible-playbook时保存脚本或输出内容?
我正在尝试调试此脚本中的错误,现在唯一出现的是:
failed: [build] => {"changed": false, "failed": true}
msg: ConnectionError(ProtocolError('Connection aborted.', error(2, 'No such file or directory')),)
Run Code Online (Sandbox Code Playgroud) 我有这个问题和答案中描述的完全相同的问题.这个问题的答案是一个很好的解决方法,但我不明白根本问题.在负载均衡器处终止SSL并在负载均衡器和Web/app服务器之间使用HTTP非常常见.什么片段不尊重X-Forwarded-Proto?是werkzeug吗?烧瓶?uwsgi?
在我的情况下,我正在使用AWS ELB(设置X-Forwarded-Proto)=> Nginx(它沿着X-Forwarded-Proto转发到uwsgi).但是在python应用程序中,我必须按照上面引用的问题中描述的Flask Request子类.
由于这是一种常见的部署方案,似乎应该有更好的解决方案.我错过了什么?
以下任务始终触发通知
第一次运行ansible时应用预期的更改,并更改行.如果我再次运行它,ansible认为它是"已更改",即使正则表达式不可能匹配,因为该行已成为"bind-address = 0.0.0.0"
为什么?
- name: Ensure MySQL will listen on all ip interfaces (bind to 0.0.0.0)
lineinfile: dest=/etc/mysql/my.cnf
regexp='bind-address\s*=\s*127\.0\.0\.1\s*'
line='bind-address = 0.0.0.0'
state=present
insertafter=EOF
notify: restart mysql
Run Code Online (Sandbox Code Playgroud) Terragrunt 文档专门讨论了是否.terraform.lock.hcl
应将文件签入源代码控制存储库。
.tf
对于terragrunt 生成的文件有何建议?它们也应该添加到源代码管理中吗?
如果不添加它们,它们似乎只会在下一次初始化/计划/应用期间重新生成。但是,管理文件似乎也很痛苦,.gitignore
这样开发人员就不必担心他们在编辑过程中没有触及的这些文件。
如果建议将它们添加到源代码管理中,那么开发人员必须确保它们至少运行terragrunt init
,terragrunt plan
以便 terragrunt 创建/更新它负责的文件。这似乎也不理想。
处理这些文件的“正确”方法是什么?
echo $SHELL
/bin/bash
echo $SHELL | wc -c
10
echo ${#SHELL}
9
Run Code Online (Sandbox Code Playgroud)
$SHELL
(eg /bin/bash
) 中的字符数是 9,那么为什么使用时结果是 10wc -c
呢?
I have this terraform.tfvars
file in the following location:
root
|_prod
|_eu-west-2
|_dev
|_terraform.tfvars
|_cognito
|_terragrunt.hcl
Run Code Online (Sandbox Code Playgroud)
it has these values:
terragrunt = {
terraform {
extra_arguments "custom_vars" {
commands = [
"apply",
"plan",
"import",
"push",
"refresh"
]
# With the get_tfvars_dir() function, you can use relative paths!
arguments = [
"-var-file=terraform.tfvars"
]
}
}
}
reply_to_email_address = "blah.blah@blah.scot"
Run Code Online (Sandbox Code Playgroud)
I can't find in the docs how to access this. I've tried get_env
:
include {
path = find_in_parent_folders()
}
terraform { …
Run Code Online (Sandbox Code Playgroud)