小编RmR*_*RmR的帖子

Docker creating multiple images

I am new to Docker and find that there are numerous images that are getting created (as seen in sudo docker images) and found somewhere in stackoverflow to periodically run sudo docker rmi $(sudo docker images -q) to remove all images. Why so many images get created? is there something wrong in my configuration?

docker-compose.yml

nginx:
  build: ./nginx
  restart: always
  ports:
    - "80:80"
    - "443:443"
  volumes:
    - /etc/letsencrypt/:/etc/letsencrypt/
  links:
    - node:node

node:
  build: ./node
  restart: always
  ports:
   - "8080:8080" …
Run Code Online (Sandbox Code Playgroud)

docker dockerfile docker-compose

6
推荐指数
2
解决办法
6204
查看次数

缓存存储与应用程序缓存

我们如何告诉支持缓存存储的浏览器忽略应用程序缓存?一些帖子提到浏览器会忽略 html5 缓存清单。但我的测试表明并非如此。

例如,如果 html 页面包含:

<html manifest="manifests/hudddle.cache">
Run Code Online (Sandbox Code Playgroud)

并且还有服务工作者代码(此处未显示),我发现这两组文件都已存储。我在 Mac OS X 上的 Chrome 63 上进行了测试。

下面是显示缓存存储的文件图像。

在此处输入图片说明

这是显示应用程序缓存的图像。

在此处输入图片说明

或者我应该在服务器端检查这个并只使用两种缓存方法中的一种吗?谢谢

html5-appcache service-worker

5
推荐指数
1
解决办法
1391
查看次数

Google功能:访问另一个项目的Firestore数据库

我希望Google Cloud项目A(project-a-id)访问另一个Google Cloud项目B(project-b-id)的Firestore数据。同样,我添加了项目A默认服务帐户,即。project-a-id@appspot.gserviceaccount.com在项目B的IAM中并将角色设置为Cloud Filestore Editor

在项目A的云功能中,我试图访问项目A的(自己的)firestore和项目B的firestore,但它始终显示两个Apps的项目A的默认数据库。代码是:

var primaryAppConfig = {
  databaseURL: 'https://project-a-id.firebaseio.com'
};
var primaryApp = admin.initializeApp(primaryAppConfig, 'primary');
var primarydb = admin.firestore(primaryApp);

var secondaryAppConfig = {
  databaseURL: 'https://project-b-id.firebaseio.com'
};
var secondaryApp = admin.initializeApp(secondaryAppConfig, 'secondary');
var secondarydb = admin.firestore(secondaryApp);

Run Code Online (Sandbox Code Playgroud)

如果给项目a的默认服务帐户授予了项目b的权利,我的印象是,它应该自动获得权利。至少当我以这种方式访问​​Google云存储桶时,它才适用。

还有其他事情要做吗?谢谢

javascript google-cloud-functions firebase-admin google-cloud-firestore

5
推荐指数
1
解决办法
367
查看次数

Google Cloud Python 函数如何访问私有 Python 包

  1. 我正在使用 Python 使用 Google Cloud Function。其他几个功能正在生产中。
  2. 但是,为此,我还创建了一个自定义 Python 包,该包可在 github 上作为私有存储库使用。
  3. 我需要在 Google Function 中安装该软件包

我做了什么

  1. 我使用本地运行 Google 函数 functions-framework
  2. 我有一个requirements.txt,它有一个包的链接。这是通过将以下行添加到requirements.txt
    -e git+https://github.com/<repo>/<project>#egg=<project>
Run Code Online (Sandbox Code Playgroud)
  1. 我跑pip install -r requirements.txt。并且包安装成功。
  2. 现在在使用import <pkg-name>作品的函数的python代码中,我能够访问所有函数。

将功能推至云端时面临的挑战

  1. 根据文档,要将 Cloud 函数推送到 Google Cloud,我发出以下命令:
gcloud functions \
  deploy <function-name> \
  --trigger-http  \
  --entry-point <entry-function> \
  --runtime python37 \
  --project=<my-project>
Run Code Online (Sandbox Code Playgroud)

正如预期的那样,这会产生错误,因为它无权访问 git 中的私有存储库。

  1. 我创建了一个 Google Cloud Repository 并将它链接到 git repo,希望能以某种方式在 requirements.txt 中指定它。就是不知道怎么办。

  2. 我尝试在 Google Cloud Function 中为用户名和密码设置环境变量(这不是一个好主意,我同意)并在以下内容中指定它们requirements.txt

    -e git+https://${AUTH_USER}:${AUTH_PASSWORD}@github.com/<repo>/<project>#egg=<project>
Run Code Online (Sandbox Code Playgroud)

这也给了一个错误。 …

python pip google-cloud-functions

5
推荐指数
2
解决办法
1651
查看次数

无法访问DOCKER容器

我已经在AWS的Ubuntu 16.04 Xenial中为Nginx和NodeJS设置了两个容器。我使用docker-compose。一切正常。

我想研究一下Nginx容器。同样,我使用命令:

sudo docker exec -it <container-name> bash
Run Code Online (Sandbox Code Playgroud)

我得到以下错误

oci runtime error: exec failed: container_linux.go:265: starting container process caused "exec: \"bash\": executable file not found in $PATH"
Run Code Online (Sandbox Code Playgroud)

路径是(使用echo $ PATH)

/home/ubuntu/bin:/home/ubuntu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/游戏:/ usr / local /游戏:/快照/ bin

docker-compose.yml是:

version: "0.9"
services:

nginx:
  build: ./nginx
  restart: always
  ports:
    - "80:80"
    - "443:443"
  volumes:
    - /etc/letsencrypt/:/etc/letsencrypt/
  links:
    - node:node

node:
  build: ./node
  restart: always
  ports:
   - "8080:8080"
  volumes:
    - ./node:/usr/src/app
    - /usr/src/app/node_modules
Run Code Online (Sandbox Code Playgroud)

我如何进入容器?谢谢

docker docker-compose

3
推荐指数
1
解决办法
1152
查看次数

浏览器通知:未显示

我似乎按照 Google Labs 的建议创建serviceWorker并编写了代码pushing notifications,但它似乎没有出现。来自服务器的推送事件似乎确实到达了浏览器,但是该showNotification功能被忽略了。

// in sw.js
self.addEventListener('push', function(event) {
 console.log('Push Received'); // this shows up
 event.waitUntil(self.registration.showNotification('Hello World'));
 // tried  self.registration.showNotification('Hello World') but still does not show up
});
Run Code Online (Sandbox Code Playgroud)

进一步检查showNotification我是否已将以下内容放入main.js.

//in main.js
console.log(Notification.permission) // shows granted
if (Notification.permission == 'granted') {
 console.log('will show notification') // this gets logged
 navigator.serviceWorker.getRegistration().then(function(reg) {
   Console.log('reached here'); // this too gets logged
   reg.showNotification('Hello world!');
 });
Run Code Online (Sandbox Code Playgroud)

最后我遇到了这个网站,有些人用来测试

https://gauntface.github.io/simple-push-demo/

https://web-push-book.gauntface.com/demos/notification-examples/

允许来自该站点的通知后,我发现使用屏幕或给定的 curl 命令没有出现任何通知。

我在 Chrome …

notifications push-notification progressive-web-apps

3
推荐指数
3
解决办法
3941
查看次数