puppeteer/assets/js/b5d551ae.77867f33.js
release-please[bot] bbea692ddf deploy: 60699da691
2024-04-11 12:01:20 +00:00

2 lines
4.3 KiB
JavaScript

/*! For license information please see b5d551ae.77867f33.js.LICENSE.txt */
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9997],{74747:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>i,default:()=>l,frontMatter:()=>s,metadata:()=>a,toc:()=>p});var n=t(85893),o=t(11151);const s={},i="Docker",a={id:"guides/docker",title:"Docker",description:"Puppeteer offers a Docker image that includes Chrome for Testing along with the required",source:"@site/../docs/guides/docker.md",sourceDirName:"guides",slug:"/guides/docker",permalink:"/next/guides/docker",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{},sidebar:"docs",previous:{title:"Puppeteer Angular Schematic",permalink:"/next/guides/ng-schematics"},next:{title:"Community",permalink:"/next/category/community"}},c={},p=[{value:"Usage",id:"usage",level:2}];function d(e){const r={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",...(0,o.a)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.h1,{id:"docker",children:"Docker"}),"\n",(0,n.jsxs)(r.p,{children:["Puppeteer offers a Docker image that includes ",(0,n.jsx)(r.a,{href:"https://developer.chrome.com/blog/chrome-for-testing/",children:"Chrome for Testing"})," along with the required\ndependencies and a pre-installed Puppeteer version. The image is available via\nthe\n",(0,n.jsx)(r.a,{href:"https://github.com/puppeteer/puppeteer/pkgs/container/puppeteer",children:"GitHub Container Registry"}),".\nThe latest image is tagged as ",(0,n.jsx)(r.code,{children:"latest"})," and other tags match Puppeteer versions.\nFor example,"]}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{className:"language-bash",children:"docker pull ghcr.io/puppeteer/puppeteer:latest # pulls the latest\ndocker pull ghcr.io/puppeteer/puppeteer:16.1.0 # pulls the image that contains Puppeteer v16.1.0\n"})}),"\n",(0,n.jsxs)(r.p,{children:["The image is meant for running the browser in sandbox mode and therefore,\nrunning the image requires the ",(0,n.jsx)(r.code,{children:"SYS_ADMIN"})," capability."]}),"\n",(0,n.jsx)(r.h2,{id:"usage",children:"Usage"}),"\n",(0,n.jsx)(r.p,{children:"To use the docker image directly, run:"}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{className:"language-bash",children:'docker run -i --init --cap-add=SYS_ADMIN --rm ghcr.io/puppeteer/puppeteer:latest node -e "$(cat path/to/script.js)"\n'})}),"\n",(0,n.jsxs)(r.p,{children:["where ",(0,n.jsx)(r.code,{children:"path/to/script.js"})," is the path relative to your working directory. Note\nthe image requires the ",(0,n.jsx)(r.code,{children:"SYS_ADMIN"})," capability since the browser runs in sandbox\nmode."]}),"\n",(0,n.jsxs)(r.p,{children:["If you need to build an image based on a different base image, you can use our\n",(0,n.jsx)(r.a,{href:"https://github.com/puppeteer/puppeteer/blob/main/docker/Dockerfile",children:(0,n.jsx)(r.code,{children:"Dockerfile"})}),"\nas the starting point."]}),"\n",(0,n.jsx)(r.admonition,{type:"caution",children:(0,n.jsxs)(r.p,{children:["Make sure to specify a init process via the ",(0,n.jsx)(r.code,{children:"--init"})," flag or a custom ",(0,n.jsx)(r.code,{children:"ENTRYPOINT"}),"\nto make sure all processes started by Puppeteer are managed properly."]})})]})}function l(e={}){const{wrapper:r}={...(0,o.a)(),...e.components};return r?(0,n.jsx)(r,{...e,children:(0,n.jsx)(d,{...e})}):d(e)}},75251:(e,r,t)=>{var n=t(67294),o=Symbol.for("react.element"),s=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,a=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function p(e,r,t){var n,s={},p=null,d=null;for(n in void 0!==t&&(p=""+t),void 0!==r.key&&(p=""+r.key),void 0!==r.ref&&(d=r.ref),r)i.call(r,n)&&!c.hasOwnProperty(n)&&(s[n]=r[n]);if(e&&e.defaultProps)for(n in r=e.defaultProps)void 0===s[n]&&(s[n]=r[n]);return{$$typeof:o,type:e,key:p,ref:d,props:s,_owner:a.current}}r.Fragment=s,r.jsx=p,r.jsxs=p},85893:(e,r,t)=>{e.exports=t(75251)},11151:(e,r,t)=>{t.d(r,{Z:()=>a,a:()=>i});var n=t(67294);const o={},s=n.createContext(o);function i(e){const r=n.useContext(s);return n.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function a(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),n.createElement(s.Provider,{value:r},e.children)}}}]);