RSelenium和Docker快速入门终端-无法连接到远程服务器

时间:2018-07-28 14:54:56

标签: r docker rselenium

我正在尝试Rselenium的初始工作。我遵循了这篇文章的指南: „ can't execute rsDriver (connection refused)

library(RSelenium)
#Let's Start
shell('docker pull selenium/standalone-firefox')
shell('docker run -d -p 4445:4444 selenium/standalone-firefox')
remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "firefox")
remDr$open()
remDr$navigate("http://www.google.com")
remDr$getTitle()

但控制台打印:

> library(RSelenium)
> #Let's Start
> shell('docker pull selenium/standalone-firefox')
Using default tag: latest
Warning: failed to get default registry endpoint from daemon (error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.37/info: open //./pipe/docker_engine: In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.). Using system default: https://index.docker.io/v1/
error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.37/images/create?fromImage=selenium%2Fstandalone-firefox&tag=latest: open //./pipe/docker_engine: Nie można odnaleźć określonego pliku. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
Warning message:
In shell("docker pull selenium/standalone-firefox") :
  wykonywanie 'docker pull selenium/standalone-firefox' error code 1
> shell('docker run -d -p 4445:4444 selenium/standalone-firefox')
docker: error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.37/containers/create: open //./pipe/docker_engine: In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
See 'docker run --help'.
Warning message:
In shell("docker run -d -p 4445:4444 selenium/standalone-firefox") :
  wykonywanie 'docker run -d -p 4445:4444 selenium/standalone-firefox' error code: 125
> remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "firefox")
> remDr$open()
[1] "Connecting to remote server"
Error in checkError(res) : 
  Undefined error in httr call. httr output: Failed to connect to localhost port 4445: Connection refused
> remDr$navigate("http://www.google.com")
Error in checkError(res) : 
  Undefined error in httr call. httr output: length(url) == 1 is not TRUE
> remDr$getTitle()
Error in checkError(res) : 
  Undefined error in httr call. httr output: length(url) == 1 is not TRUE

我可以请求帮助吗?

1 个答案:

答案 0 :(得分:0)

在cmd @FOR /f "tokens=*" %i IN ('docker-machine.exe env --shell cmd') DO @%i中运行此命令,然后尝试。