Why am I getting a syntax error with RSelenium in Docker? - docker

I am trying to follow this tutorial RSelenium and scraping as it seems to be just what I am trying to do. Use RSelenium to scrape a Javascript website.
I have installed Docker and all seems good, but I run into problems with the following command:
remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "firefox'")
which I think is intended to be:
remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "firefox")
However, both versions return this error:
bash: syntax error near unexpected token `('
What am I doing wrong?
Here is the full log:
Starting "default"...
(default) Check network to re-create if needed...
(default) Windows might ask for the permission to configure a dhcp server. Sometimes, such confirmation window is minimized in the taskbar.
(default) Waiting for an IP...
Machine "default" was started.
Waiting for SSH to be available...
Detecting the provisioner...
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.
Regenerate TLS machine certs? Warning: this is irreversible. (y/n): Regenerating TLS certificates
Waiting for SSH to be available...
Detecting the provisioner...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/
docker is configured to use the default machine with IP 192.168.99.100
For help getting started, check out the docs at https://docs.docker.com
Start interactive shell
graha#LAPTOP-SWIFT MINGW64 /c/Program Files/Docker Toolbox
$ docker pull selenium/standalone-chrome Using default tag: latest
latest: Pulling from selenium/standalone-chrome
Digest: sha256:d46e05c47bad20ec4ad675368fa1b7addb6c9529e8fdc23f5eb55629235b8e14
Status: Image is up to date for selenium/standalone-chrome:latest
graha#LAPTOP-SWIFT MINGW64 /c/Program Files/Docker Toolbox
$ docker run -d -p 4445:4444 selenium/standalone-chrome fbb8c9145e92789f6941cc04fb74d216d43aed178825c1698ede2644589c715f
graha#LAPTOP-SWIFT MINGW64 /c/Program Files/Docker Toolbox
$ remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "chrome")
bash: syntax error near unexpected token `('
graha#LAPTOP-SWIFT MINGW64 /c/Program Files/Docker Toolbox
$
Thanks.

Your basic problem is that you're trying to type an R command at the bash shell prompt, and that's never going to work. I think you may be missing the point of the tutorial you're following:
The Docker image you're using just provides Selenium, a tool for remotely controlling web browsers. It is expected that you are running R on your host, and pointing the RSelenium library at the selenium service offered by the Docker container.
You will need to install R on your host in order to follow that tutorial.

Related

port 80 refused - digital ocean droplet web console w/ caprover instance

I have a cap rover instance in my digital ocean instance that I created. I want to use teh caprover instance to run cap rover sample apps.
I opened the digital ocean droplet web console in order to run a caprover isntance.
I ran the following lines of code:
ufw allow 80,443,3000,996,7946,4789,2377/tcp; ufw allow 7946,4789,2377/udp;
and got this:
Skipping adding existing rule
Skipping adding existing rule (v6)
Skipping adding existing rule
Skipping adding existing rule (v6)
I then ran this:
docker run -p 80:80 -p 443:443 -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock -v /captain:/captain caprover/caprover
I got this:
Unable to find image 'caprover/caprover:latest' locally
latest: Pulling from caprover/caprover
Digest: sha256:39c3f188a8f425775cfbcdc4125706cdf614cd38415244ccf967cd1a4e692b4f
Status: Downloaded newer image for caprover/caprover:latest
docker: Error response from daemon: driver failed programming external connectivity on endpoint priceless_sammet (9da9028cfc4873818f113458237ebd00f9c64fa648b853730a60b10bea39c720): Bind for 0.0.0.0:3000 failed: port is already allocated.
I tried changing the ports to:
docker run -p 81:81 -p 444:444 -p 3321:3321 -v /var/run/docker.sock:/var/run/docker.sock -v /captain:/captain caprover/caprover
and got this:
Captain Starting ...
Installing Captain Service ...
Installation of CapRover is starting...
For troubleshooting, please see: https://caprover.com/docs/troubleshooting.html
>>> Checking System Compatibility <<<
Docker Version passed.
Ubuntu detected.
X86 CPU detected.
Total RAM 1033 MB
Are your trying to run CapRover on a local machine or a machine without public IP?
In that case, you need to add this to your installation command:
-e MAIN_NODE_IP_ADDRESS='127.0.0.1'
Otherwise, if you are running CapRover on a VPS with public IP:
Your firewall may have been blocking an in-use port: 80
A simple solution on Ubuntu systems is to run "ufw disable" (security risk)
Or [recommended] just allowing necessary ports:
ufw allow 80,443,3000,996,7946,4789,2377/tcp; ufw allow 7946,4789,2377/udp;
See docs for more details on how to fix firewall issues
Finally, if you are an advanced user, and you want to bypass this check (NOT RECOMMENDED),
you can append the docker command with an addition flag: -e BY_PASS_PROXY_CHECK='TRUE'
Installation failed.
Error: Port seems to be closed: 80
at Request._callback (/usr/src/app/built/utils/CaptainInstaller.js:149:24)
at Request.self.callback (/usr/src/app/node_modules/request/request.js:185:22)
at Request.emit (events.js:400:28)
at Request.<anonymous> (/usr/src/app/node_modules/request/request.js:1154:10)
at Request.emit (events.js:400:28)
at IncomingMessage.<anonymous> (/usr/src/app/node_modules/request/request.js:1076:12)
at Object.onceWrapper (events.js:519:28)
at IncomingMessage.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1334:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
How can I open port 80, 443, and 3000 so that I can run the cap rover instance

ansible over docker hosts does not as expected

I'm facing a bit weird issue targeting in ansible docker containers.
Inventory
el7_02 ansible_port=6000 ansible_user=user ansible_host=localhost
el7_03 ansible_port=6001 ansible_user=user ansible_host=localhost
playbook
- shell: hostname
register: x
- debug: msg="{{ x.stdout}}, {{ansible_hostname}}, {{ansible_user}}, {{ansible_port}}"
output
TASK [Gathering Facts] *************************************************************************************************
ok: [el7_03]
ok: [el7_02]
TASK [x : shell] *************************************************************************************************
changed: [el7_03]
changed: [el7_02]
TASK [x : debug] *************************************************************************************************
ok: [el7_03] => {
"msg": "el7_02, el7_02, user, 6001"
}
ok: [el7_02] => {
"msg": "el7_02, el7_02, user, 6000"
}
as you can see for some reasons I see not expected hostname for the container el7_03. While I'd expect to see in a debug tasks for the docker el7_03 the same hostname (i.e. el7_03 but not el7_02). Why I receive "the wrong" output?
checking hostnames in docker
~/ $ ssh -p 6000 user#localhost 'hostname'
el7_02
~/ $ ssh -p 6001 user#localhost 'hostname'
el7_03
if I will switch to ansible_connection=docker then I get what I expect. however, I cannot use it because when I interact with anything located outside of my laptop (installing anything or downloading from the internet) time to time (and quite often) I receive timeouts. Maybe there is a way how to get rid of timeouts?
os: macos
ansible: 2.9.11
python: 3.8.5
docker: 19.0.3.8
thank you
you need to work around the issue that ansible looks up a host via hostname and not via hostname:port pair .
my workaround for this issue is as follows:
$ grep pi. /etc/hosts
127.0.0.1 pi1
127.0.0.1 pi2
127.0.0.1 pi3
# inventory contents:
$ cat all_rpis.ini
pi1:3321
pi2:3322
pi3:3323

How to open mobsf using docker

## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/
docker is configured to use the default machine with IP 192.168.99.100
For help getting started, check out the docs at https://docs.docker.com
Start interactive shell
laptop#LAPTOP-MDLBUKKN MINGW64 /c/Program Files/Docker Toolbox
$ docker pull opensecurity/mobile-security-framework-mobsf
Using default tag: latest
latest: Pulling from opensecurity/mobile-security-framework-mobsf
d51af753c3d3: Pull complete fc878cd0a91c: Pull complete 6154df8ff988: Pull complete fee5db0ff82f: Pull complete 2147c66bc825: Pull complete 0adbcd19651f: Pull complete c941f22acae2: Pull complete 2b48d720aadd: Pull complete c88c099643b2: Pull complete 00718adcba2f: Pull complete 9ec8cb716172: Pull complete 98b4a4bffe15: Pull complete 3d492495d95b: Pull complete ab0f85fef3b0: Pull complete 0df7809d4cce: Pull complete 8aa79076efbd: Pull complete Digest: sha256:7be8e3b29f2f3ce92077078ac3b053c3bdb33a627ea07256730e92a0fe20d3cb
Status: Downloaded newer image for opensecurity/mobile-security-framework-mobsf:latest
docker.io/opensecurity/mobile-security-framework-mobsf:latest
laptop#LAPTOP-MDLBUKKN MINGW64 /c/Program Files/Docker Toolbox
$ # Static Analysis Only
laptop#LAPTOP-MDLBUKKN MINGW64 /c/Program Files/Docker Toolbox
$ docker run -it -p 8000:8000 opensecurity/mobile-security-framework-mobsf:latest
[2020-05-01 03:06:02 +0000] [1] [INFO] Starting gunicorn 20.0.4
[2020-05-01 03:06:02 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
[2020-05-01 03:06:02 +0000] [1] [INFO] Using worker: threads
[2020-05-01 03:06:02 +0000] [7] [INFO] Booting worker with pid: 7
How to open mobsf using docker , I have typed some commands , and any mistakes I have made? I still can't open ,dunno know how to open it ..please tell me the solution of the question , thanks !
You can run docker instance of mobsf via the prebuilt image using below commands
docker pull opensecurity/mobile-security-framework-mobsf
docker run -it --rm -p 8000:8000 opensecurity/mobile-security-framework-mobsf:latest
For more options for running mobsf docker, please view official documentation here
You have probably found a solution to this, but I will recommend not using the docker version. If you need help setting it up local this post describes it:
How to run Mobile Security Framework (MobSF)
By running it through docker you will lose the opportunity to use Dynamic analysis (often referred to as "DAST")

docker-machine create keeps asking for password

I am attempting to docker-machine create to a Ubuntu 16.04 host like this:
ssh-keygen -R ${remote_host}
ssh-copy-id -i ~/.ssh/id_host_rsa.pub root#${remote_host}
docker-machine create \
--driver generic \
--generic-ip-address=${remote_host} \
--generic-ssh-key ~/.ssh/id_host_rsa \
--generic-ssh-user=root ${machine_name}
Version information:
docker --version
Docker version 19.03.6, build 369ce74a3c
docker-machine --version
docker-machine version 0.16.2, build bd45ab13
I am repeatedly asked for a password .. Why is this?
Here is the output:
...
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: ERROR: Received disconnect from 77.68.21.66 port 22:2: Too many authentication failures
ERROR: Disconnected from 77.68.21.66 port 22
Running pre-create checks...
Creating machine...
(production) Importing SSH key...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Password:
Detecting the provisioner...
Password:
Provisioning with ubuntu(systemd)...
Password:
.. etc
The reason for this problem was the ordering of ~/.ssh/config.
I had a Host * entry in config first, before that of my corresponding specific server Host XX.XX.XX.XX entry.
I moved the wildcard entry at the end of ~/.ssh/config and now the password is no longer constantly asked for and the problem is now fixed.
I how this helps someone.

Docker - Unable to find any JVMs - Error checking TLS connection

I am just doing the docker installation guide. After the install I open "Docker Quickstart Terminal" (Step 3). I am getting this error:
bash --login '/Applications/Docker/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh'
Unable to find any JVMs matching version "1.8.60".
Error checking TLS connection: Something went wrong running an SSH command!
command : ip addr show
err : exit status 255
output :
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/
Error getting IP address: Something went wrong running an SSH command!
command : ip addr show
err : exit status 255
output :
docker is configured to use the default machine with IP
For help getting started, check out the docs at https://docs.docker.com
I checked my java version:
➜ ~ java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
I am using OSX 10.11.3 and iTerm with Zsh.
What's wrong?
EDIT:
This is the output of running docker-machine ls:
➜ ~ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default * virtualbox Running Unknown Something went wrong running an SSH command!
command : ip addr show
err : exit status 255
output :
It looks like your virtualbox instance is running but isn't running correctly and it can't connect to docker. you have two options.
Remove the virtualbox instance and create a new one. (only delete if you are sure you don't need anything else)
$ docker-machine rm default
$ docker-machine create --driver virtualbox default
This is more work, but worth it if you need to save stuff on the VM. Try and find out what is wrong with the virtualbox instance and fix it.
Firs try restarting
$ docker-machine restart default
try sshing into the virtualbox
$ docker-machine ssh default
If you can get into the VM, then you can find out if docker is running and if not, try and get it running.

Resources