| 1 |
Docker Images |
| 2 |
============= |
| 3 |
|
| 4 |
Example docker images are maintained at https://github.com/dask/dask-docker . |
| 5 |
|
| 6 |
Each image installs the full Dask conda environment (including the distributed |
| 7 |
scheduler), Numpy, and Pandas on top of a Miniconda installation on top of |
| 8 |
a Debian image. |
| 9 |
|
| 10 |
These images are large, around 1GB. |
| 11 |
|
| 12 |
- ``ghcr.io/dask/dask``: This a normal debian + miniconda image with the full Dask |
| 13 |
conda package (including the distributed scheduler), Numpy, and Pandas. |
| 14 |
This image is about 1GB in size. |
| 15 |
|
| 16 |
- ``ghcr.io/dask/dask-notebook``: This is based on the |
| 17 |
`Jupyter base-notebook image <https://hub.docker.com/r/jupyter/base-notebook/>`_ |
| 18 |
and so it is suitable for use both normally as a Jupyter server, and also as |
| 19 |
part of a JupyterHub deployment. It also includes a matching Dask software |
| 20 |
environment described above. This image is about 2GB in size. |
| 21 |
|
| 22 |
Example |
| 23 |
------- |
| 24 |
|
| 25 |
Here is a simple example on a dedicated virtual network |
| 26 |
|
| 27 |
.. code-block:: bash |
| 28 |
|
| 29 |
docker network create dask |
| 30 |
|
| 31 |
docker run --network dask -p 8787:8787 --name scheduler ghcr.io/dask/dask dask-scheduler # start scheduler |
| 32 |
|
| 33 |
docker run --network dask ghcr.io/dask/dask dask-worker scheduler:8786 # start worker |
| 34 |
docker run --network dask ghcr.io/dask/dask dask-worker scheduler:8786 # start worker |
| 35 |
docker run --network dask ghcr.io/dask/dask dask-worker scheduler:8786 # start worker |
| 36 |
|
| 37 |
docker run --network dask -p 8888:8888 ghcr.io/dask/dask-notebook # start Jupyter server |
| 38 |
|
| 39 |
Then from within the notebook environment you can connect to the Dask cluster like this: |
| 40 |
|
| 41 |
.. code-block:: python |
| 42 |
|
| 43 |
from dask.distributed import Client |
| 44 |
client = Client("scheduler:8786") |
| 45 |
client |
| 46 |
|
| 47 |
Extensibility |
| 48 |
------------- |
| 49 |
|
| 50 |
Users can mildly customize the software environment by populating the |
| 51 |
environment variables ``EXTRA_APT_PACKAGES``, ``EXTRA_CONDA_PACKAGES``, and |
| 52 |
``EXTRA_PIP_PACKAGES``. If these environment variables are set in the container, |
| 53 |
they will trigger calls to the following respectively:: |
| 54 |
|
| 55 |
apt-get install $EXTRA_APT_PACKAGES |
| 56 |
conda install $EXTRA_CONDA_PACKAGES |
| 57 |
python -m pip install $EXTRA_PIP_PACKAGES |
| 58 |
|
| 59 |
For example, the following ``conda`` installs the ``joblib`` package into |
| 60 |
the Dask worker software environment: |
| 61 |
|
| 62 |
.. code-block:: bash |
| 63 |
|
| 64 |
docker run --network dask -e EXTRA_CONDA_PACKAGES="joblib" ghcr.io/dask/dask dask-worker scheduler:8786 |
| 65 |
|
| 66 |
Note that using these can significantly delay the container from starting, |
| 67 |
especially when using ``apt``, or ``conda`` (``pip`` is relatively fast). |
| 68 |
|
| 69 |
Remember that it is important for software versions to match between Dask |
| 70 |
workers and Dask clients. As a result, it is often useful to include the same |
| 71 |
extra packages in both Jupyter and Worker images. |
| 72 |
|
| 73 |
Source |
| 74 |
------ |
| 75 |
|
| 76 |
Docker files are maintained at https://github.com/dask/dask-docker. |
| 77 |
This repository also includes a docker-compose configuration. |