- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当chromium启动成功时,它的Debugging WebSocket URL应该是ws://127.0.0.1:9222/devtools/browser/ec261e61-0e52-4016-a5d7-d541e82ecb0a
.127.0.0.1:9222
应该能够通过 Chrome 浏览以检查 headless Chromium。但是,在对我的应用程序进行 dockerize 后,我无法通过 Chrome 访问远程调试器 URL。
launchOption由 Puppeteer 启动 Chrome :
{
"args": [
"--remote-debugging-port=9222",
"--window-size=1920,1080",
"--mute-audio",
"--disable-notifications",
"--force-device-scale-factor=0.8",
"--no-sandbox",
"--disable-setuid-sandbox"
],
"defaultViewport": {
"height": 1080,
"width": 1920
},
"headless": true
}
FROM node:10.16.3-slim
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& wget --quiet https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh -O /usr/sbin/wait-for-it.sh \
&& chmod +x /usr/sbin/wait-for-it.sh
WORKDIR /usr/app
COPY ./ ./
VOLUME ["......." ]
RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
&& mkdir -p /home/pptruser/Downloads \
&& chown -R pptruser:pptruser /home/pptruser \
&& chown -R pptruser:pptruser /usr/app \
&& npm install
USER pptruser
CMD npm run start
EXPOSE 3000 9222
docker run \
-p 3000:3000 \
-p 9222:9222 \
pptr
ERR_EMPTY_RESPONSE
当我浏览时
127.0.0.1:9222
和
DOCKER-INTERNAL-IP:9222
会超时。
最佳答案
我知道已经有一个可以接受的答案,但让我补充一下,希望能大大减少您的图像大小。如果可以帮助它,则不应在 Dockerfile 中添加太多额外内容。但最终,添加 --remote-debugging-port=9222 和 --remote-debugging-address=0.0.0.0 将允许您访问它。
文件
FROM ubuntu:latest
LABEL Full Name <email@email.com> https://yourwebsite.com
WORKDIR /home/
COPY wrapper-script.sh wrapper-script.sh
# install chromium-browser and cleanup.
RUN apt update && apt install chromium-browser --no-install-recommends -y && apt autoremove && apt clean && apt autoclean && rm -rf /var/lib/apt/lists/*
# Run your commands and add environment variables from your compose file.
CMD ["sh", "wrapper-script.sh"]
#!/bin/bash
# Start the process
chromium-browser --headless --disable-gpu --no-sandbox --remote-debugging-port=9222 --remote-debugging-address=0.0.0.0 ${URL}${USERNAME}
status=$?
if [ $status -ne 0 ]; then
echo "Failed to start chromium-browser: $status"
exit $status
fi
# Naive check runs checks once a minute to see if either of the processes exited.
# This illustrates part of the heavy lifting you need to do if you want to run
# more than one service in a container. The container exits with an error
# if it detects that either of the processes has exited.
# Otherwise it loops forever, waking up every 60 seconds
while sleep 60; do
ps aux |grep chromium-browser | grep -q -v grep
PROCESS_1_STATUS=$?
# If the greps above find anything, they exit with 0 status
# If they are not both 0, then something is wrong
if [ $PROCESS_1_STATUS -ne 0 ]; then
echo "One of the processes has already exited."
exit 1
fi
done
version: '3.7'
services:
chrome:
command: [ 'sh', 'wrapper-script.sh' ]
image: headless-chrome
build:
context: .
dockerfile: Dockerfile
environment:
- USERNAME=eaglejs
- URL=https://teamtreehouse.com/
ports:
- 9222:9222
docker-compose up
我有一个容器在运行。现在,使用端口部分,您还必须做一些事情来扩展它。如果您要运行
docker-compose up --scale chrome=5
您的端口会发生冲突,但如果您想尝试,请告诉我,我会看看我可以为扩展做些什么,但除此之外,如果是用于测试,这应该可以正常工作。 :) 快乐编码!
eaglejs
关于docker - 如何通过 Puppeteer 访问用于 dockerized Chromium 启动的远程调试页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58428213/
我最近刚跨过木偶继承。围绕它的几个问题: 使用p继承是一种好习惯吗?一些经验丰富的木偶同事告诉我,木偶的继承不是很好,我不太相信。 来自OO世界,我真的很想了解木偶继承的原理,以及覆盖的原理。 最佳答
需要一个 puppet 特工联系一些不同 puppet 师。 原因:不同的组创建了不同且独立的 list 集。 可能的组及其任务 应用程序供应商:应用程序的配置 安全性:强化 运营:路由表、监控工具
您可以在 puppet 中制作子模块吗,例如... puppet_root - modules - module_1 - submodule - manifes
在执行类 mypackage 中的代码之前,我需要执行类 mysql,tomcat。在我的 site.pp 我有 node 'node1' { include mysql,mypackage,tomc
我试图从失败的请求和js错误中收集数据。 我正在使用以下网站:https://nitzani1.wixsite.com/marketing-automation/3rd-page 该网站有一个对htt
我在 Suse 11 Linux 机器上使用 puppet 2.7.19 和 facter 1.6.0。 $::osfamily因子变量未设置,尽管它确实有 $::operatingsystem事实集
我正在使用 Puppet 开源版本。 我发现 Puppet 3.7.5 中有几个组件: puppet 大师 puppet 代理 MCollective 希拉 puppet 数据库 但我不知道他们是如何
主要目标是自动添加所有 puppet 模块,以便可以使用一个命令启动所有 dev-env 和 prod-env。如何通过 puppet manifest 安装 puppet 模块? 最佳答案 我们一直
我的 Puppet list 中有一系列 exec: 第一个下载带有二进制文件的 ZIP 文件(除非已经安装了二进制文件)并将其保存到 /tmp。 第二个将其解压缩。 当我第一次应用 list 时,它
我使用 aws opsworks 创建了 puppet master。我可以将 ami linux 节点自动添加到 puppet master。 当我尝试通过此链接 https://puppet.co
关于 this 的另一个问题问题。 有没有办法puppet module install从我已经下载到磁盘的本地存储库安装的工具? 最佳答案 您可以使用Puppet Library托管您自己的私有(p
我可以通过 Puppet Enterprise Master 到 Agent 运行几乎所有其他命令,但更新命令不会运行。据我所知,PE确实以root身份运行。 有人可以建议如何让这个命令在 Linux
我只想在 puppeteer 中刚刚打开的页面中应用标题,而不是在所有内部页面标题中应用标题 page.setExtraHTTPHeaders({ 'X-Just-Must-Be-Req
有没有什么方法可以用 Puppet 的语言声明数组中的包应该按照它们在数组中给出的顺序安装? 我想自动安装 CUDA,这需要 nvidia-driver-latest-dkms、cuda 和 cuda
鉴于这个简化的 Puppet 示例,很明显,由于 ~> 链接运算符,对 my_file 的任何更改都会触发 my_service 刷新: package { 'my_package': } -> fi
我是第一次使用 puppeteer,而不是工程师/程序员! 我已经能够生成我尝试使用 puppeteer 的大部分表单,但是我被单选按钮卡住了。网络表单中的开发人员工具显示该字段的以下内容: 使用:
如果您为代理在后台运行时执行 puppet agent -t,我们可以在其中看到更改的日志文件在哪里,而不是在 puppet 仪表板上。 我查看了 puppet.conf 并在主要部分看到了 logd
我正在尝试使用 exec 资源类型来执行批处理文件。但我想将变量 $dsn_64bit 的值从 init.pp 传递到 install.pp。请让我知道如何实现: 这是我的 init.pp class
我正在尝试使用 list 将用户分配到多个组,但遇到了障碍。 尝试 1: class usergroup { group { "user_one": ensure => present
我想先说我是 puppet 的新手。我一直在通过 vagrant 使用它并且我开始对写作表现感到自在,但我可能缺乏可以回答我的问题的经验或直觉。 我试图掌握 puppet 的范围以及画线的位置。我对这
我是一名优秀的程序员,十分优秀!