How to copy files to each user's space in docker

I am writing a docker file to conduct an evaluation of an R package that I have written. The package is installed inside RStudio server. My docker file inherits from FROM rocker/rstudio. I want the docker file to install the everything (which it does) and create 20 users (user1, user2, …, user20) as test subjects. Each test subject additionally should have a data folder (/home/data) to contain some CSV files.
Later when the container is run, The RStudio’s web interface allows the test subjects to login using the user credentials just created. They have access to their own data, perform the tests, and generates some new files in their home directory.

I am able to create the users using RUN useradd -ms /bin/bash user1 and set the current user to users USER user1, but do not know how to transfer the files alongside the Dockerfile.

  • Access docker-machine VM ports without port forwarding
  • docker-compose can't connect to external network
  • Dynamic DNS Resolution with HAProxy and Docker
  • dockerize c#.NET desktop application
  • Recommended way to mimic a production server with Docker
  • npm install doesn't work in Docker
  • Note 1: I do not like the dea of putting the files on the host machine and sharing them with the docker users. Instead I want to have them shipped with the Dockerfile and get them added to the image and container when the Dockerfile is built and run.
    Note 2: I need to do the evaluation is a reproducible way, because I need to repeat it several times.

  • Multiple Docker images filesystem scan
  • Docker port forwarding with dual network interface
  • Gitlab run docker inside docker
  • Rancher with postgresql
  • How to Bootstrap from Workstaion to Docker conatiner?
  • Salt minion inside docker container?
  • One Solution collect form web for “How to copy files to each user's space in docker”

    You can use the COPY or ADD command in the dockerfile to get files in to you docker machine. Have a look here for more information.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.