Merge pull request #9 from jtyberg/unix_sock

Connect to Docker daemon on host through Unix socket.
This commit is contained in:
Min RK 2016-05-10 09:20:18 +02:00
commit 63f7c4b6cf
2 changed files with 3 additions and 12 deletions

View File

@ -15,19 +15,14 @@ services:
# Bind Docker binary from host machine so we can invoke Docker commands # Bind Docker binary from host machine so we can invoke Docker commands
# from inside container # from inside container
- "/usr/local/bin/docker:/usr/local/bin/docker:ro" - "/usr/local/bin/docker:/usr/local/bin/docker:ro"
# Bind Docker TLS certs from host machine so we can authenticate with the # Bind Docker socket on the host so we can connect to the daemon from
# daemon on the host (DOCKER_HOST should be set to host's IP) # within the container
- "/etc/docker:/etc/docker:ro" - "/var/run/docker.sock:/var/run/docker.sock:rw"
# Bind Docker volume on host for JupyterHub database and cookie secrets # Bind Docker volume on host for JupyterHub database and cookie secrets
- "data:${DATA_VOLUME_CONTAINER}" - "data:${DATA_VOLUME_CONTAINER}"
ports: ports:
- "443:443" - "443:443"
environment: environment:
# Pass DOCKER_HOST to container to allow it to connect to daemon on host
DOCKER_HOST: ${DOCKER_HOST}
# Locations of TLS certificate and key needed to auth with daemon on host
DOCKER_TLS_CERT: "/etc/docker/server.pem"
DOCKER_TLS_KEY: "/etc/docker/server-key.pem"
# All containers will join this network # All containers will join this network
DOCKER_NETWORK_NAME: ${DOCKER_NETWORK_NAME} DOCKER_NETWORK_NAME: ${DOCKER_NETWORK_NAME}
# JupyterHub will spawn this Notebook image for users # JupyterHub will spawn this Notebook image for users

View File

@ -39,10 +39,6 @@ c.DockerSpawner.volumes = { '{username}': '/home/jovyan/work' }
c.DockerSpawner.extra_create_kwargs.update({ 'volume_driver': 'local' }) c.DockerSpawner.extra_create_kwargs.update({ 'volume_driver': 'local' })
# Remove containers once they are stopped # Remove containers once they are stopped
c.DockerSpawner.remove_containers = True c.DockerSpawner.remove_containers = True
# Specify paths to TLS certificate and key used to authenticate to Docker
# daemon at DOCKER_HOST
c.DockerSpawner.tls_cert = os.environ['DOCKER_TLS_CERT']
c.DockerSpawner.tls_key = os.environ['DOCKER_TLS_KEY']
# For debugging arguments passed to spawned containers # For debugging arguments passed to spawned containers
c.DockerSpawner.debug = True c.DockerSpawner.debug = True