I have got the following Docker file
FROM jupyter/scipy-notebook
COPY . ./work
RUN pip install -r ./work/requirements.txt
WORKDIR /work
CMD ["python", "./work/append_dependencies.py"]
and the following docker-compose.yml
version: '3.7'
networks:
george:
services:
jupyter:
build: .
image: jupyter/datascience-notebook:r-4.0.3
environment:
- JUPYTER_TOKEN=password
- JUPYTER_ENABLE_LAB=yes
volumes:
- .:/home/jovyan/work
- ./notebooks:/home/jovyan/work
- ./src:/home/jovyan/work
ports:
- 7777:8888
container_name: almond_analysis
networks:
- george
The project structure is:
almond_analysis:
notebooks:
data_exploration.ipynb
src:
__init__.py
plots.py
.gitignore
docker-compose.yml
Dockerfile
README.md
requirements.txt
setup.py
The file append_dependencies.py looks like this:
import sys
sys.path.append("/home/jovyan/work")
What I would like to do is execute the file append_dependencies.py automatically after I type docker compose up -d --build. Right now, after I build and run my container (with docker compose up -d --build), the container crashes, i.e. after I type docker ps I get the following output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
I tried changing CMD to ENTRYPOINT but the result was the same.
Does anyone know how to execute append_dependencies.py right after I build the container with docker compose up -d --build?