Last active
August 9, 2017 19:04
-
-
Save D3f0/f021473d0d6a87bb3dedd2d7c9f9212a to your computer and use it in GitHub Desktop.
Start Jupyter notebook in your Django compose project without adding any service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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