・ I want to easily build a data analysis environment for the time being. ・ You have an environment where you can use docker. ・ I can understand the contents of the Dockerfile. ・ I can understand linux commands.
・ Isn't it okay to put anaconda on the host? If you install anaconda etc., it will be difficult to uninstall. -Since the entire container can be thrown away, it can be used easily. -You can start up the environment of other people immediately with just one Dockerfile. Environment construction becomes stress-free.
anaconda is a package that includes Python and the library NumPy SchiPy jupyter required for data analysis. This time, the main tool jupyter is also included, so there is no reason not to use it. I don't want to spend time building the environment. If you have a recent anaconda3, you probably have jupyter, so any version is fine.
The actual Dockerfile is as follows. This OS is described in ubuntu.
FROM ubuntu:latest RUN apt-get -y update && apt-get install -y \ wget WORKDIR /opt RUN wget https://repo.continuum.io/archive/Anaconda3-2020.07-Linux-x86_64.sh && \ sh /opt/Anaconda3-2020.07-Linux-x86_64.sh -b -p /opt/anaconda3 ENV PATH /opt/anaconda3/bin:$PATH RUN pip install --upgrade pip WORKDIR / CMD ["jupyter", "lab", "--ip=0.0.0.0", "--allow-root", "--LabApp.token=''"]
Only the minimum required command execution is executed
I will try it. Execute the following command in the directory containing the Dockerfile.
docker build .
Sending build context to Docker daemon 5.632kB Step 1/6 : FROM ubuntu:latest ---> 4e2eef94cd6b Step 2/6 : RUN apt-get -y update && apt-get install -y wget ---> Running in ab7a4f407583 Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB] Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB] Get:3 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [221 kB] Get:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease [111 kB] Get:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB] Get:6 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [1078 B] Get:7 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB] Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB] ・ ・ ・ ・ ・ Omitted Removing intermediate container 5e6f539725f5 ---> 8f167186b465 Step 5/6 : ENV PATH /opt/anaconda3/bin:$PATH ---> Running in da3a2e6521c3 Removing intermediate container da3a2e6521c3 ---> 7306fc34e088 Step 6/6 : CMD ["jupyter", "lab", "--ip=0.0.0.0", "--allow-root", "--LabApp.token=''"] ---> Running in 79cd954afcc4 Removing intermediate container 79cd954afcc4 ---> 7b05db009f7f Successfully built 7b05db009f7f
Use the image ID of
Successfully built image ID when starting the container.
The container will start by executing the following command.
docker run -p 8888: 8888 above image ID
[I 03:32:07.355 LabApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret [W 03:32:08.010 LabApp] All authentication is disabled. Anyone who can connect to this server will be able to run code. [I 03:32:08.034 LabApp] JupyterLab extension loaded from /opt/anaconda3/lib/python3.8/site-packages/jupyterlab [I 03:32:08.034 LabApp] JupyterLab application directory is /opt/anaconda3/share/jupyter/lab [I 03:32:08.037 LabApp] Serving notebooks from local directory: /opt [I 03:32:08.037 LabApp] The Jupyter Notebook is running at: [I 03:32:08.037 LabApp] http://439ce26ee905:8888/ [I 03:32:08.038 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [W 03:32:08.042 LabApp] No web browser found: could not locate runnable browser.
You should be able to access it by launching your browser and typing
localhost: 8888 in the URL.