diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file diff --git a/README.md b/README.md index 5d88ecc..38b2525 100644 --- a/README.md +++ b/README.md @@ -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 ` 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 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() + ```