Skip to content

Instantly share code, notes, and snippets.

@D3f0
Last active August 9, 2017 19:04
Show Gist options
  • Save D3f0/f021473d0d6a87bb3dedd2d7c9f9212a to your computer and use it in GitHub Desktop.
Save D3f0/f021473d0d6a87bb3dedd2d7c9f9212a to your computer and use it in GitHub Desktop.
Start Jupyter notebook in your Django compose project without adding any service
# jupyter must be installed in the container, and if you want fancy tables, pandas too.
# docker exec -u 0 $(docker-compose -f $(COMPOSE_FILE) images -q django) pip install jupyter pandas
start_jupyter: ## Starts a Jupyter
$(eval DJANGO_IMAGE := $(shell docker-compose -f $(COMPOSE_FILE) images -q django))
$(eval DJANGO_CONTAINER := $(shell docker-compose -f $(COMPOSE_FILE) ps -q django))
$(eval POSTGRES_CONTAINER := $(shell docker-compose -f $(COMPOSE_FILE) ps -q postgres))
$(eval ANOTHER_POSTGRES_CONTAINER := $(shell docker-compose -f $(COMPOSE_FILE) ps -q another-postgres))
@docker run --rm \
--volumes-from $(DJANGO_CONTAINER) \
-p 8888:8888 \
--env-file ./django-container/env.env \
--link $(POSTGRES_CONTAINER) \
--link $(ANOTHER_POSTGRES_CONTAINER) \
--net project_default \
$(DJANGO_IMAGE) \
jupyter-notebook --ip='*' \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment