conda jupyter error jupyter_core library with docker

I’m trying to work on a docker for pytorch, using the following files.
However I keep getting this weird error message after the docker-compose up command :

Creating learningpytorch_notebook_1 ... 
Creating learningpytorch_notebook_1 ... done
Attaching to learningpytorch_notebook_1
notebook_1  | Traceback (most recent call last):
notebook_1  |   File "/opt/conda/bin/jupyter", line 7, in <module>
notebook_1  |     from jupyter_core.command import main
notebook_1  | ModuleNotFoundError: No module named 'jupyter_core'
learningpytorch_notebook_1 exited with code 1

This is my docker-compose.yaml:

version: "3"
services:
  notebook:
    build: ./
    image: anaconda-pytorch-notebook
    volumes:
      - ./:/src
    ports:
      - "8888:8888"

This is my Dockerfile:

FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04


ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ENV PATH /opt/conda/bin:$PATH

RUN apt-get update --fix-missing && apt-get install -y wget bzip2 ca-certificates 
libglib2.0-0 libxext6 libsm6 libxrender1 
git mercurial subversion

RUN wget --quiet https://repo.anaconda.com/archive/Anaconda3-5.3.0-Linux-x86_64.sh -O ~/anaconda.sh && 
/bin/bash ~/anaconda.sh -b -p /opt/conda && 
rm ~/anaconda.sh && 
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && 
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && 
conda install pytorch torchvision cuda100 -c pytorch && 
echo "conda activate base" >> ~/.bashrc

#all the code samples for the video series
VOLUME ["/src"]

#serve up a jupyter notebook 
WORKDIR /src
EXPOSE 8888

#this has security disabled which is less fuss for learning purposes
CMD jupyter notebook --port=8888 --ip=0.0.0.0 --allow-root --NotebookApp.token='' --NotebookApp.disable_check_xsrf=True

I tried to rebuild this many times using docker-compose build or the docker-compose up --build but I couldn’t manage to get this to work even though in the installation process I can see that jupyter notebook module is being installed.

Source: StackOverflow