-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,45 @@ | ||
# docker-tutorial | ||
Supporting files for a series of docker tutorials for coworkers | ||
# Docker Tutorial | ||
|
||
Files & notes for a series of docker tutorials for coworkers. | ||
|
||
## Notes for the presenter | ||
|
||
1. Getting things working | ||
1. Everybody run `docker run hello-world` to make sure Docker is installed and working. | ||
2. `docker run -it <your-favorite-distro>` such as debian, rocky, alpine, etc. | ||
3. Quiz: What does `-it` do? Could check with `docker run --help` or at https://docs.docker.com/reference/. | ||
|
||
2. Running something useful: Jupyter Notebooks | ||
1. `docker run -p 8888:8888 quay.io/jupyter/datascience-notebook:latest` | ||
2. Find the login URL in the output and open it in your browser. Should see the notebook interface. | ||
3. Do something. | ||
4. Try something with a missing library such as `import scikit-learn`. | ||
|
||
3. Dockerfiles | ||
1. Create a `Dockerfile` that installs the missing library. | ||
```Dockerfile | ||
from quay.io/jupyter/datascience-notebook:latest | ||
RUN conda install --quiet --yes scikit-learn tensorflow | ||
``` | ||
1. Note: Instead, you could `docker exec -it <container-id> bash` and install the library manually, but then it wouldn't be sharable or saved for future work. | ||
2. Think of Docker images as snapshots that you can save for later or share. _"Infrastructure as code."_ | ||
2. Build a new local Docker image | ||
```shell | ||
$ docker build . -t my-notebook | ||
$ docker run -p 8888:8888 my-notebook | ||
``` | ||
3. [Try again with the missing library](https://scikit-learn.org/stable/auto_examples/bicluster/plot_spectral_biclustering.html#generate-sample-data). | ||
```python | ||
from matplotlib import pyplot as plt | ||
from sklearn.datasets import make_checkerboard | ||
n_clusters = (4, 3) | ||
data, rows, columns = make_checkerboard( | ||
shape=(300, 300), n_clusters=n_clusters, noise=10, shuffle=False, random_state=42 | ||
) | ||
plt.matshow(data, cmap=plt.cm.Blues) | ||
plt.title("Original dataset") | ||
_ = plt.show() | ||
``` |