OS:Windows10 Home 1909 Docker:Docker Toolbox Docker version: 19.03.12
I was ashamed to use Docker for the first time in Jupyter environment maintenance, and I didn't know much about Docker. I will write it with a sense of self-discipline. * Use docker-compose.yml
The Docker image is built on the basis of the Dockerfile. Once you build
the Docker image, a cache will be created. Simply put, the cache speeds up the second and subsequent reads. If there is this cache, it will be used preferentially during build
. Therefore, when you update the Dockerfile, use docker-compose build --no-cache
to do a build
that does not use the cache.
Please note that it may take a long time depending on the thing because it is a build
that does not use a cache.
Dockerfile
FROM jupyter/datascience-notebook
RUN pip install --upgrade pip
RUN pip install jupyterlab
RUN jupyter serverextension enable --py jupyterlab
RUN curl -L "https://moji.or.jp/wp-content/ipafont/IPAexfont/IPAexfont00401.zip" > font.zip
RUN unzip font.zip
RUN cp IPAexfont00401/ipaexg.ttf /opt/conda/lib/python3.8/site-packages/matplotlib/mpl-data/fonts/ttf/ipaexg.ttf
RUN echo "font.family : IPAexGothic" >> /opt/conda/lib/python3.8/site-packages/matplotlib/mpl-data/matplotlibrc
RUN rm -r ./.cache
In a Windows environment, run it with Docker Quickstart Terminal.
Move to the directory containing dockerfile and docker-compose.yml corresponding to Dockerfile described in Dockerfile with cd
, and execute the following command (Notes Please also check).
docker-compose build
docker-compose up -d
If you have not set the token value in docker-compose.yml (the empty value is assumed to be "set"), I think that the URL is output to Terminal (eg http://127.0.0.1: 8888 /? token = ...). Jupyter can be used by accessing it with any browser including its token value.
Once Jupyter is available, run the following in Python:
import matplotlib
import matplotlib.pyplot as plt
plt.figure()
plt.title('Ah- A')
plt.ylabel('I- i')
plt.xlabel('U- Uu')
As a result, if the output looks like the image below, you can use Japanese! Thank you for your hard work!
After graduating from the Anaconda environment, we will finally move to the Docker environment! It was good that I was enthusiastic, but I was new to Docker and had only knowledge of the data analysis system, so I was not familiar with IT knowledge and stumbled many times. Actually, I gave up once to be able to use this Japanese.
Also, recent articles are only for mac environment, and it is hard to find articles for windows environment. However, the environment of the article on the windows environment changes over time, and even if you type the code as it is, it may not work. It's fun to improve those codes, but it's difficult when you're a beginner ...