Skip to content

Instantly share code, notes, and snippets.

@lpirola
Forked from joebeeson/docker-compose.yaml
Created July 8, 2024 23:14
Show Gist options
  • Save lpirola/35d803be6021ace0d0b95b98c766475b to your computer and use it in GitHub Desktop.
Save lpirola/35d803be6021ace0d0b95b98c766475b to your computer and use it in GitHub Desktop.
Anchors in docker-compose.yaml
version: "3.4"
x-defaults: &defaults
image: "dask-dev/dask-notebook"
# With lists, each entry requires its own anchor if you
# intend to extend/reuse an entry in concrete services.
configs:
- &configs_condarc
source: "condarc"
target: "/etc/conda/condarc"
mode: 444
- &configs_pip
source: "pip"
target: "/etc/pip.conf"
mode: 444
# For dictionaries anchor at the root.
environment: &environment
DASK_SCHEDULER_ADDRESS: "tcp://dask_scheduler:8786"
EXTRA_APT_PACKAGES: "g++ unixodbc-dev"
EXTRA_PIP_PACKAGES: "pip"
NB_GID: "100"
GRANT_SUDO: "yes"
volumes:
- &volumes_localtime
type: "bind"
source: "/etc/localtime"
target: "/etc/localtime"
read_only: yes
# Bind host certificates into container -- ensure that
# the path matches the container's expectations.
- &volumes_certificates
type: "bind"
source: "/etc/pki/tls/certs/ca-bundle.crt"
target: "/etc/ssl/certs/ca-certificates.crt"
read_only: yes
# Now define the services, overriding the values as
# needed:
services:
jupyterlab_foo:
<<: *defaults
environment:
<<: *environment
NB_USER: "foo"
jupyterlab_bar:
<<: *defaults
environment:
<<: *environment
NB_USER: "bar"
jupyterlab_bar:
<<: *defaults
environment:
<<: *environment
NB_USER: "baz"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment