Skip to content

Commit

Permalink
notes for initial session
Browse files Browse the repository at this point in the history
  • Loading branch information
wbbaker committed Jul 1, 2024
1 parent a05197b commit 72b2fd5
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
47 changes: 45 additions & 2 deletions README.md
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()
```

0 comments on commit 72b2fd5

Please sign in to comment.