Docker image to run nlmixr through RStudio Server
247
This repository includes the docker file(s) for nlmixr. There are two types of docker images being created, a development version and a production version. The development version installs the latest github version for nlmixr while the development version will install the latest CRAN versions of all packages (if available).
Before working with the nlmixr docker file, the docker software should be installed. An installer is available for all major operating systems:
Make sure you read the prequisites, especially on windows this is not always straightforward. On other systems it is sufficient to download and run the installer. Take into account that there might be some other differences when working with windows, these are specified in the last section.
To run a docker image, a terminal window (or command prompt in windows) should be used. There are different ways of running the nlmixr docker, which are explained in the upcoming sections.
The easiest method is to directly run the docker files from dockerhub https://hub.docker.com/r/yoshidk6/nlmixr. Take into account that the first time doing this, it will donwload all applicable files from the repository. This can take some time depending on your internet speed. After the first time, the image will be saved locally and it the machine will start almost immediately. The following command can be issued to run the container:
docker run -v /Users/USERNAME/Documents/nlmixr_test:/home/rstudio/docs -d -p 8787:8787 -e PASSWORD=nlmixr yoshidk6/nlmixr
Some explanation for the command:
-v option is used to mount a volume to the docker container. Although it is not not mandatory, it is highly recommended to easily run and save nlmixr models. In this example the the folder "Users/richard/Document/nlmixr_test" will be mounted to the docs folder in the home directory. Multiple folders can be mounted, as long as they are accessible on the host computer-d option will run the container in detached mode-p option will publish a container's port (or a range of ports) to the host-e option will set environment variables. For the Rstudio docker which is being used on the background a password should be given.Once the docker container is running, you can go to a browser and go to the following url:
localhost:8787
This will fire up an Rstudio server version. If everything went correctly you will see a login screen for Rstudio. You can login with username rstudio and password nlmixr. If a local folder was mounted you should be able to find this directly in the files pane in Rstudio.
To build a file on your local system, the following method was proposed by Bill Denney:
git clone https://github.com/yoshidk6/nlmixr.docker.git
cd nlmixr.docker/prod
docker build . -t nlmixr
Once the docker is build, it can be started as indicated in the previous section.
Once you are done, or you would want to start another instance of the container, you can close the browser window and from the terminal the following can be done to stop all containers:
docker kill $(docker ps -q)
Each time you stop the container or restart/log-off, the container should be started again using the docker run command as stated above.
In case you want to stop a specific container, you can list the running containers with docker container ls and close the specific container ID (e.g. docker container stop 1fa4ab2cf395)
You can also execute these actions with GUI from "Dashboard", which you can find by clicking the Docker icon in the task bar (right-click for Windows)
localhost is not recognized and the url should be 127.0.0.1:8787On windows it can take some more effort to mount local drives. The following method was proposed by Nick Holford (link):
docker run -v C:/Users/USERNAME/Documents/nlmixr_test:/home/rstudio/docs -d -p 8787:8787 -e PASSWORD=nlmixr nlmixr/nlmixrdev:V0.1
You now have access to other directories in /home/rstudio in addition to examples and kitematic (i.e. analysis, data, models, scripts, ShinyMixR).
If you are using Docker Toolbox on Windows 7, the Docker Machine IP instead of localhost should be used. For example, http://192.168.99.100:8787/. To find the IP address, the ipconfig command can be used. In windows it might be necessary to stop the container using powershell, otherwise the container can be stopped using task manager.
Compared to https://github.com/RichardHooijmaijers/nlmixr.docker, the following changes were made:
rocker/tidyverse:3.6.3 as base imagereticulate::install_miniconda()Content type
Image
Digest
Size
1.5 GB
Last updated
about 6 years ago
docker pull yoshidk6/nlmixr