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.

  • How to Give Docker Containers more resources
  • DataStax Enterprise on Docker: fails to start due to /hadoop/conf directory not being writable
  • Deploying Meteor application with Docker and phusion-passenger
  • Linking docker containers to combine different libraries
  • docker: how to do/setup networking container-to-host for udp / snmp
  • Meteor Up deployment error
  • 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.

  • How to atomically update a counter shared between Docker instances
  • How do I automate two layers of SSH plus a docker exec?
  • Run a new container based on currently running container
  • Install Docker on a specific volume
  • Does it make sense to dockerize (containerize) databases?
  • Running docker container : iptables: No chain/target/match by that name
  • 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.