puppeteer/assets/js/b5d551ae.edde413d.js
release-please[bot] cc95c085a2 deploy: 1014abc087
2023-11-29 13:34:30 +00:00

2 lines
4.0 KiB
JavaScript

/*! For license information please see b5d551ae.edde413d.js.LICENSE.txt */
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9997],{74747:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>o,metadata:()=>a,toc:()=>p});var n=r(85893),s=r(11151);const o={},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:"Evaluate JavaScript",permalink:"/next/guides/evaluate-javascript"},next:{title:"Request Interception",permalink:"/next/guides/request-interception"}},c={},p=[{value:"Usage",id:"usage",level:2}];function d(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",...(0,s.a)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(t.h1,{id:"docker",children:"Docker"}),"\n",(0,n.jsxs)(t.p,{children:["Puppeteer offers a Docker image that includes ",(0,n.jsx)(t.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)(t.a,{href:"https://github.com/puppeteer/puppeteer/pkgs/container/puppeteer",children:"GitHub Container Registry"}),".\nThe latest image is tagged as ",(0,n.jsx)(t.code,{children:"latest"})," and other tags match Puppeteer versions.\nFor example,"]}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.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)(t.p,{children:["The image is meant for running the browser in sandbox mode and therefore,\nrunning the image requires the ",(0,n.jsx)(t.code,{children:"SYS_ADMIN"})," capability."]}),"\n",(0,n.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,n.jsx)(t.p,{children:"To use the docker image directly, run:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.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)(t.p,{children:["where ",(0,n.jsx)(t.code,{children:"path/to/script.js"})," is the path relative to your working directory. Note\nthe image requires the ",(0,n.jsx)(t.code,{children:"SYS_ADMIN"})," capability since the browser runs in sandbox\nmode."]}),"\n",(0,n.jsxs)(t.p,{children:["If you need to build an image based on a different base image, you can use our\n",(0,n.jsx)(t.a,{href:"https://github.com/puppeteer/puppeteer/blob/main/docker/Dockerfile",children:(0,n.jsx)(t.code,{children:"Dockerfile"})}),"\nas the starting point."]})]})}function u(e={}){const{wrapper:t}={...(0,s.a)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(d,{...e})}):d(e)}},75251:(e,t,r)=>{var n=r(67294),s=Symbol.for("react.element"),o=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,t,r){var n,o={},p=null,d=null;for(n in void 0!==r&&(p=""+r),void 0!==t.key&&(p=""+t.key),void 0!==t.ref&&(d=t.ref),t)i.call(t,n)&&!c.hasOwnProperty(n)&&(o[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===o[n]&&(o[n]=t[n]);return{$$typeof:s,type:e,key:p,ref:d,props:o,_owner:a.current}}t.Fragment=o,t.jsx=p,t.jsxs=p},85893:(e,t,r)=>{e.exports=r(75251)},11151:(e,t,r)=>{r.d(t,{Z:()=>a,a:()=>i});var n=r(67294);const s={},o=n.createContext(s);function i(e){const t=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:i(e.components),n.createElement(o.Provider,{value:t},e.children)}}}]);