title: How to resolve RSelenium error message "Failed to connect to localhost port 4444: Connection refused"?
body: <p>I am trying to use <code>RSelenium</code> with <code>Docker</code>to crawl a website. However, I have some issues trying to get <code>RSelenium</code>/<code>Docker</code> to work.</p>
  
  <p>Specifically, I installed <code>Docker</code> on my computer, which appears to be running fine (I see the image of the whale below when I open it).</p>
  
  <p><a href="https://i.stack.imgur.com/DUmFs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DUmFs.png" alt="Docker screenshot"></a></p>
  
  <p>In R, I then run the following code with no problems and see the expected output.</p>
  
  <pre><code>shell('docker run -d -p 4445:4444 selenium/standalone-chrome')
  shell('docker ps')
  CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS              PORTS                    NAMES
  d7de815ce644        selenium/standalone-chrome   "/opt/bin/entry_poinâ€¦"   13 minutes ago      Up 13 minutes       0.0.0.0:4445-&gt;4444/tcp   zen_mclean
  </code></pre>
  
  <p>But when I then run the following code, I always receive the following error message:</p>
  
  <pre><code>remDr &lt;- RSelenium::remoteDriver(remoteServerAddr = "localhost",
                               port = 4444,
                               browserName = "chrome")
  remDr$open()
  [1] "Connecting to remote server"
  Error in checkError(res) : 
    Undefined error in httr call. httr output: Failed to connect to localhost port 4444: Connection refused
  </code></pre>
  
  <p>I am not sure what is going on here (I'm new to scraping). Can anybody help me figure out what to do here?</p>
  
  <p>If it helps, I am running Windows 10.</p>