Dyfan Jones
Dyfan Jones

Reputation: 264

How to set up a data volume within docker?

I am trying to set up rocker/rstudio docker on a linux ubuntu 14.04.5 with a data volume so all my data is outside of the docker. I have looked at Manage data in containers for some some guidance.

sudo docker run -d -p 8787:8787 rocker/rstudio  -v ~/data/

I get back the following error:

docker: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"exec: \\"-v\\": executable file not found in $PATH\"\n".

Upvotes: 0

Views: 188

Answers (1)

Yaron Idan
Yaron Idan

Reputation: 6765

  1. Your -v flag should appear before the name of the image your want to run. If you list it after the image name docker will interpret it as the command used to launch the container.
  2. You shouldn't use ~ when referring to the container volume. A better approach would be to use an absolute path like /data
  3. If you are using a data volume in order to get persistence, consider mounting a host directory as your data volume (as seen in the tutorial you've linked to under Mount a host directory as a data volume.

Your final command should look something like this -

sudo docker run -d -p 8787:8787 -v /src/data:/data/ rocker/rstudio

Upvotes: 1

Related Questions