title: Install a Firefox browser binary for Puppeteer in Docker
body: <p>I'm trying to run a script with a dependency of <a href="https://github.com/pevers/images-scraper" rel="nofollow noreferrer">https://github.com/pevers/images-scraper</a> in a Docker container. I can run the script on its own (on my machine which has Node 14.15.4, doing <code>node src/index.js</code> which will yield the console outout of A), but in the context of docker it is not working - I am getting an error message about a missing Firefox binary.</p>
  <p>Dockerfile:</p>
  <pre><code>FROM node:14
  
  WORKDIR /usr/src/app
  
  COPY package*.json ./
  
  RUN npm install
  
  RUN PUPPETEER_PRODUCT=firefox npm install puppeteer
  
  COPY . .
  
  CMD [ &quot;node&quot;, &quot;src/index.js&quot; ]
  </code></pre>
  <p>src/index.js:</p>
  <pre><code>let Scraper = require(&quot;images-scraper&quot;);
  
  const google = new Scraper({
    puppeteer: {
      userAgent:
        &quot;Mozilla/5.0 (X11; Linux i686; rv:64.0) Gecko/20100101 Firefox/64.0&quot;, 
      headless: true,
      safe: true,
    },
  });
  
  
  (async () =&gt; {
    const A = await google.scrape(&quot;bananas&quot;, 200);
    console.log(A)
  })();
  
  </code></pre>
  <p>package.json</p>
  <pre><code>{
      &quot;name&quot;: &quot;test&quot;,
      &quot;version&quot;: &quot;1.0.0&quot;,
      &quot;scripts&quot;: {
        &quot;test&quot;: &quot;node src/index.js&quot;
      },
      &quot;dependencies&quot;: {
        &quot;images-scraper&quot;: &quot;^6.2.1&quot;
      }
    }
  </code></pre>
  <p>When I <code>/bin/bash</code> into my container and do <code>node src/index.js</code> I get the error:</p>
  <pre><code>    at ChromeLauncher.launch (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/node/Launcher.js:79:23)
      at async GoogleScraper.scrape (/usr/src/app/node_modules/images-scraper/src/google/scraper.js:53:21)
      at async /usr/src/app/src/index.js:19:13
  </code></pre>
  <p>New to using Node with Docker - I was wondering where I am going wrong here. Thanks</p>