run rscript on local in a docker image - r

I have pulled a kaggle/rstats image on my local windows machine. I want to run a local code script.r in the kaggle image.
My code script.r is stored in "D:/codes/script.r." I have installed docker and pulled kaggle/rstats image in "E:/docker."
Can somebody please help with how to run script.r in kaggle docker image.
I have been using the following command to run it but of course there is some issue with it which I can't figure out.
docker run -v $PWD:D:/codes -w=D:/codes --rm -it kaggle/rstats Rscript script.r
Output:
docker: Error response from daemon: Invalid bind mount spec "/c/Users/Rohan:D:/codes": invalid mode: /codes.
See 'E:\Docker Toolbox\docker.exe run --help'.
I tried following as well:
docker run -v /D:/codes -w=/D:/codes --rm -it kaggle/rstats Rscript script.r
Output:
Fatal error: cannot open file 'script.r': No such file or directory
script.r is present in D:/codes, not sure why it is saying no such file.
What is wrong in the command?

Related

Cant find local volume on Docker rocker

I can't seem to solve this question, even though it seems that this has been answered here:
I am trying to run the rocker/tensorflow Docker container in Ubuntu 20.04 but I also need it to access the following folder /home/au687614/Documents/LUCAS_ML
So I tried to follow this answer and run this:
docker run -d -p 8787:8787 -v $(pwd):/home/au687614/Documents/LUCAS_ML:/home/rstudio/LOOKATMEEE -e ROOT=TRUE rocker/tensorflow
This however gets me the following error:
docker: Error response from daemon: invalid mode: /home/rstudio/LOOKATMEEE.
See 'docker run --help'
What is my mistake?
A correct syntax would be:
docker run -d -p 8787:8787 -e PASSWORD=yourpassword -v /path/to/your/local/folder:/home/rstudio/LOOKATMEEE:rw rocker/tensorflow
This comes from this e-book where you can find explanations about the syntax and other Docker essentials explained.

I keep getting this error "docker: invalid reference format: repository name must be lowercase."

I keep getting this error even my repo name is lowercase, the code i´m running is this sudo docker container run --rm -p 3838:3838 -v /home/ubuntu/la-liga-2018-2019-stats/stats/:/srv/shiny-server/stats -v /home/ubuntu/log/shiny-server/:/var/log/shiny-server/
BorisRendon/shinyauth. I´m trying to deploy a shiny app to aws using docker and i can´t pass this step.
You should probably use docker run and not docker container run.

ShinyProxy Euler App not running - Failed to start container

I am new to docker and ShinyProxy. I was following the steps from https://www.shinyproxy.io/. All is working fine with the Hello-world and 06_tabset apps. Then I have build the Image for the Euler App which is not working when opening the app from the browser.
Error
Status code: 500
Message: Failed to start container
Stack Trace:
eu.openanalytics.containerproxy.ContainerProxyException: Failed to start container
EDIT:
The actual error is:
Caused by: com.spotify.docker.client.exceptions.DockerRequestException: Request error: POST http://localhost:2375/containers/create: 400, body: {"message":"No command specified"}
also when I try to just run the App it is not working with:
sudo docker run -p 3838:3838 openanalytics/shinyproxy-demo R -e 'shiny::runApp('/root/euler')'
the Error I get is:
shiny::runApp(/root/euler)
Error: unexpected '/' in "shiny::runApp(/"
Execution halted
and after changing it to:
sudo docker run -p 3838:3838 openanalytics/shinyproxy-demo R -e 'shiny::runApp('root/euler')'
I get this:
Error in as.shiny.appobj(appDir) : object 'root' not found
Calls: <Anonymous> -> as.shiny.appobj
Execution halted
I think the problem could be that the Image is openanalytics/shinyproxy-template and not openanalytics/shinyproxy-demo.
try:
sudo docker run -p 3838:3838 openanalytics/shinyproxy-template R -e 'shiny::runApp("/root/euler")'
just try this :
sudo docker run -p 3838:3838 openanalytics/shinyproxy-demo R -e 'shiny::runApp("/root/euler")'
the problem is that you use ' twice in your command that is why the app sees that as 'shiny::runApp(/'
and make sure that Shiny application exists at the path "/root/euler".

Pass parameters to docker container using docker run command

I have created a docker image using Dockerfile mentioned below. There is a jar file in the image which needs few parameters to run it. I am passing the parameters using docker run command but it throws me error. Find the details below.
Dockerfile content
FROM ubuntu:14.04
ENV http_proxy http://http.proxy.nxp.com:7000
ENV https_proxy http://http.proxy.nxp.com:7000
RUN apt-get update
<set of lines for installing java is here>
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
copy apache-jmeter-3.1 /apache-jmeter-3.1
RUN mkdir /jarloc
copy Test.jar /jarloc
RUN java -version
ENTRYPOINT [ java -jar /jarloc/Test.jar ]
RUN ls -l /jarloc
I created an image called as jmaster:1.0 and gave following command to spin the container.
docker run jmaster:1.0 http://win_loc/soasta_parent/soasta/MyPOC/Login_Data.csv http://win_loc/soasta_parent/soasta/MyPOC/Dpc_data.csv 30 300 30
This gives me following error.
http://win_loc/soasta_parent/soasta/MyPOC/Login_Data.csv: 1: [:
missing ]
I am able to run this script from inside docker (docker run -it jmaster:1.0 /bin/bash). It gives me correct output. But when I try to pass the parameter in docker run command, I am getting this error. Am I passing this in a wrong way or is there any other way to do so?
When I go inside docker using 'docker run -it imagename /bin/bash' and execute following, I am getting correct results from jar.
/jarloc#java -jar Test.jar http://win_loc/soasta_parent/soasta/MyPOC/Login_Data.csv http://win_loc/soasta_parent/soasta/MyPOC/Dpc_data.csv 30 300 30
Try with
ENTRYPOINT ["java","-jar","/jarloc/Test.jar"]
That should take the parameters in docker run

how can I set the working directory in old version of docker in the run command?

I am a bit new to docker and I have been trying to run deploy a meteor container with my meteor application. I have been using the dockerfile and instructions from https://registry.hub.docker.com/u/golden/meteor-dev/
However, I cant run docker run -p 3000:3000 -t -i -v /path/to/meteor/app:/opt/application -w /opt/application meteor-dev because my docker (version 0.5.3) does not recognize the flag (-w) to set the working directory.
Is there some workaround to set the working directory with docker 0.5.3? The work directory is already set in the docker file, but I guess I need to set it again when I run the container.
well, my workaround was to create a bash script that would go to the working directory and call the commands one by one. I created the bash script where my source is located "/path/to/meteor/app" and call docker run -p 3000:3000 -t -i -v /path/to/meteor/app:/opt/application meteor-dev bash /opt/application/start.sh with the bash as command and my script as argument

Resources