You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Running JupyterLab** In the terminal, navigate to the directory where you want to run JupyterLab, and run
78
-
the following command.
79
-
```
80
-
docker run --rm -v $(pwd):/home/jovyan/work -p 8888:8888 ubcdsci/r-dsci-100:20230724142640d8f06f jupyter lab
81
-
```
82
-
The terminal will then print some text as the Docker container starts. Once the text stops scrolling, find the
83
-
URL in your terminal that starts with `http://127.0.0.1:8888` (highlighted by the red box Figure \@ref(fig:ubuntu-docker-terminal)), and paste it into your browser to start JupyterLab.
84
-
85
-
```{r ubuntu-docker-terminal, echo = FALSE, fig.cap = "The terminal text after running the Docker container in Ubuntu. The red box indicates the URL that you should paste into your browser to open JupyterLab.", fig.retina = 2, out.width="100%"}
86
-
image_read("img/setup/ubuntu-docker.png") |>
87
-
image_crop("3632x2000")
88
-
```
89
-
90
-
More information on installing and running Docker on Ubuntu, as well as troubleshooting tips, can be found
91
-
[in the online Docker documentation](https://docs.docker.com/engine/install/ubuntu/).
92
-
93
-
### MacOS
94
-
95
-
**Installation** To install Docker on MacOS,
96
-
visit [the online Docker documentation](https://docs.docker.com/desktop/install/mac-install/), and
97
-
download the `Docker.dmg` installation file that is appropriate for your
98
-
computer. To know which installer is right for your machine, you need to know
99
-
whether your computer has an Intel processor (older machines) or an
100
-
Apple processor (newer machines); the [Apple support page](https://support.apple.com/en-ca/HT211814) has
101
-
information to help you determine which processor you have. Once downloaded, double-click
102
-
the file to open the installer, then drag the Docker icon to the Applications folder.
103
-
Double-click the icon in the Applications folder to start Docker. In the installation
104
-
window, use the recommended settings.
105
-
106
-
**Running JupyterLab** Once Docker is installed and running, follow the
107
-
instructions below in the Windows section on *Running JupyterLab* (the user
108
-
interface is the same). More information on installing and running Docker on
109
-
MacOS, as well as troubleshooting tips, can be
110
-
found [in the online Docker documentation](https://docs.docker.com/desktop/install/mac-install/).
66
+
> **Note:** A *container* is a virtualized user space within your computer.
67
+
> Within the container, you can run software in isolation without interfering with the
68
+
> other software that already exists on your machine. In this book, we use
69
+
> a container to run a specific version of the R programming
70
+
> language, as well as other necessary packages. The container ensures that
71
+
> the worksheets function correctly, even if you have a different version of R
72
+
> installed on your computer—or even if you haven't installed R at all!
111
73
112
74
### Windows
113
75
114
-
**Installation** To install Docker on Windows, visit [the online Docker documentation](https://docs.docker.com/desktop/install/windows-install/),
Once the image is done downloading, click the "Images" button on the left side of the Docker Desktop window (Figure \@ref(fig:docker-desktop-images)). You
105
+
Once the image is done downloading, click the "Images" button on the left side
106
+
of the Docker Desktop window (Figure \@ref(fig:docker-desktop-images)). You
146
107
will see the recently downloaded image listed there under the "Local" tab.
To start up a *container* using that image, click the play button beside the image. This will open the run configuration menu (Figure \@ref(fig:docker-desktop-runconfig)).
154
-
In the "Host port" textbox, enter `8888`. In the "Volumes" section, click the "Host path" box and navigate to the folder where your Jupyter worksheets
155
-
are stored. In the "Container path" text box, enter `/home/jovyan/work`. Then click the "Run" button to start the container.
114
+
To start up a *container* using that image, click the play button beside the
115
+
image. This will open the run configuration menu (Figure \@ref(fig:docker-desktop-runconfig)).
116
+
Expand the "Optional settings" drop down menu. In the "Host port" textbox, enter
117
+
`8888`. In the "Volumes" section, click the "Host path" box and navigate to the
118
+
folder where your Jupyter worksheets are stored. In the "Container path" text
119
+
box, enter `/home/jovyan/work`. Then click the "Run" button to start the
120
+
container.
156
121
157
122
```{r docker-desktop-runconfig, echo = FALSE, fig.cap = "The Docker Desktop container run configuration menu.", fig.retina = 2, out.width="100%"}
158
123
image_read("img/setup/docker-3.png") |>
@@ -165,10 +130,67 @@ URL in the terminal that starts
165
130
with `http://127.0.0.1:8888` (highlighted by the red box in Figure \@ref(fig:ubuntu-docker-terminal)), and paste it
166
131
into your browser to start JupyterLab.
167
132
168
-
```{r docker-desktop-url, echo = FALSE, fig.cap = "The terminal text after running the Docker container in Ubuntu. The red box indicates the URL that you should paste into your browser to open JupyterLab.", fig.retina = 2, out.width="100%"}
133
+
134
+
```{r docker-desktop-url, echo = FALSE, fig.cap = "The terminal text after running the Docker container. The red box indicates the URL that you should paste into your browser to open JupyterLab.", fig.retina = 2, out.width="100%"}
169
135
image_read("img/setup/docker-4.png") |>
170
136
image_crop("3632x2000")
171
137
```
138
+
When you are done working, make sure to shut down and remove the container by
139
+
clicking the red trash can symbol (in the top right corner of Figure \@ref(fig:ubuntu-docker-terminal)).
140
+
You will not be able to start the container again until you do so.
141
+
More information on installing and running
142
+
Docker on Windows, as well as troubleshooting tips, can
143
+
be found in [the online Docker documentation](https://docs.docker.com/desktop/install/windows-install/).
144
+
145
+
### MacOS
146
+
147
+
**Installation** To install Docker on MacOS,
148
+
visit [the online Docker documentation](https://docs.docker.com/desktop/install/mac-install/), and
149
+
download the `Docker.dmg` installation file that is appropriate for your
150
+
computer. To know which installer is right for your machine, you need to know
151
+
whether your computer has an Intel processor (older machines) or an
152
+
Apple processor (newer machines); the [Apple support page](https://support.apple.com/en-ca/HT211814) has
153
+
information to help you determine which processor you have. Once downloaded, double-click
154
+
the file to open the installer, then drag the Docker icon to the Applications folder.
155
+
Double-click the icon in the Applications folder to start Docker. In the installation
156
+
window, use the recommended settings.
157
+
158
+
**Running JupyterLab** Run Docker Desktop. Once it is running, follow the
159
+
instructions above in the Windows section on *Running JupyterLab* (the user
160
+
interface is the same). More information on installing and running Docker on
161
+
MacOS, as well as troubleshooting tips, can be
162
+
found in [the online Docker documentation](https://docs.docker.com/desktop/install/mac-install/).
163
+
164
+
### Ubuntu
165
+
166
+
**Installation** To install Docker on Ubuntu, open the terminal and enter the following five commands.
```{r ubuntu-docker-terminal, echo = FALSE, fig.cap = "The terminal text after running the Docker container in Ubuntu. The red box indicates the URL that you should paste into your browser to open JupyterLab.", fig.retina = 2, out.width="100%"}
188
+
image_read("img/setup/ubuntu-docker.png") |>
189
+
image_crop("3632x2000")
190
+
```
191
+
192
+
193
+
172
194
173
195
## Working with JupyterLab Desktop
174
196
@@ -180,28 +202,24 @@ that require expert troubleshooting. The downside of JupyterLab Desktop is that
180
202
you may not end up with the right versions of all the R packages needed for the worksheets. Docker, on the other hand,
181
203
*guarantees* that the worksheets will work exactly as intended.
182
204
183
-
In this section, we will cover how to install Git (for version control, as discussed in Chapter \@ref(Getting-started-with-version-control)),
184
-
JupyterLab Desktop, the JupyterLab Git extension, and all of the R packages needed to run the code in this book.
205
+
In this section, we will cover how to install JupyterLab Desktop,
206
+
Git and the JupyterLab Git extension (for version control, as discussed in Chapter \@ref(Getting-started-with-version-control)), and
0 commit comments