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.

  • In docker container how to run another container command?
  • Unable to run docker image created from ISO
  • spark-submit can't use sparkConf to pass configuration parameters
  • Disk management (cleanup) in a stopped docker container
  • docker-compose postgresql persitent local storage
  • Server and client network apps simulated in one machine
  • 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.

  • Docker - Is it possible to recreate volume container without recreating the containers that use it
  • Share docker socket using user namespaces
  • Travis-CI: docker image as build environment
  • pass cookie from http response via nginx proxy
  • Vagrant or Docker for environment development
  • 'nutc': unknown terminal type. docker
  • 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.