-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker.Rmd
49 lines (37 loc) · 1.04 KB
/
docker.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
title: "Docker cheatsheet"
output: github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, eval = FALSE)
```
Pull the Rstudio image from Docker hub.
```{bash}
docker pull rocker/rstudio
docker images
docker images -a
# to clean
docker images rmi <imageID>
```
Start/stop container
```{bash}
# run with root to be able to install dependencies; safe on local only probably
docker run -dp 8787:8787 -e ROOT=TRUE rocker/rstudio
# on a remote server, don't use default logins
USER=[user]
PW=[pw]
docker run -dp 8787:8787 -e ROOT=TRUE -e USER=$USER -e PASSWORD=$PW rocker/rstudio
docker ps
docker stop <imageID>
docker ps -a
docker rm <imageID>
docker start <imageID>
```
Access Rstudio at "localhost:8787", default credentials are "rstudio".
Installing system dependencies with `apt-get` requires ssh-ing into the container. If the terminal pane is blank, try in global options disabling "connect with Web sockets".
```{bash}
docker exec -it <imageID> bin/bash
apt-get update
apt-get install python3-pip
pip3 install docopt
```