For small white mirror instructions

Docker is a lightweight virtual machine software, which can realize image migration through a single command. This image explains that when we learn programming, there are always a lot of programming software to download. The configuration of programming software in each language takes a lot of time, and the software in different programming languages is different, such as VScode, VC6.0, Pycharm, Idea, Eclips Even if you are used to vim programming, Jupyter can also be a good fit for you

Download docker official website link https://www.docker.com/ after downloading, install Docker under Windows, Linux can directly yum, or apt directly install Docker

CMD check whether docker is successfully installed docker --version Output Docker version 19.03.5, build 633A0EACopy the code

Jupyter password LMKLMK SSH password LMK19980312

The image size is 1.5 GB and includes the compilers for languages such as JUPyterlab conda GCC g++ Java13 PYTHon37

Run the following command as a command line administrator on Windows
docker run -tdi   -p 20022:22  -p 20088:8888  --name   kernel1   --privileged=true  registry.cn-hangzhou.aliyuncs.com/mkmk/conda:v2  init  | docker exec -d  kernel1   /bin/bash -c "cd /home && source /etc/profile && nohup jlab &"


# use under Linux
docker run -tdi   -p 20022:22  -p 20088:8888  --name   kernel1   --privileged=true  registry.cn-hangzhou.aliyuncs.com/mkmk/conda:v2  init  &&  docker exec -d  kernel1   /bin/bash -c "cd /home && source /etc/profile && nohup jlab &"
Copy the code
English character version v1 Chinese characters is the edition is registry.cn-hangzhou.aliyuncs.com/mkmk/conda:v2Copy the code

It can be used after the command is executedlocalhost:20088 Visit jupyter lab, access password LMKLMK and then you can start a variety of language programming, c++ recommended c++17

At the end of the tutorial, if you want to learn how to build a docker image, you can take a look at the complete process of building a docker image below. If you have the ability, you can also help add more kernels into it, such as c#,swift,javascript, and then leave your blog reply, blog and mirror address

Original Jupuyter environment created

The first step is to create a JUPyterLab environment

# Windows command
docker run -tdi   -p 10022:22  -p 18888:8888  --name jlab1   --privileged=true registry.cn-hangzhou.aliyuncs.com/mkmk/python37:al1  init | docker exec -d jlab1 /bin/bash -c "cd /jupyterlab && nohup jlab &"
Copy the code




Installation C Environment

GCC is already included in the environment. Create a file and write the following code

 #include<stdio.h> int main() 
  {
     printf (" py helloWorld,Best wish! \n");
     return 0;   
  }
Copy the code
GCC cs1.c -o hello./hellow Prints sh-4.2# ./hello
 py helloWorld,Best wish!
Copy the code




Install the c++ environment

Install the g + +

Yum -y install GCC GCC -c++ kernel-devel cmake sh-4.2# g++ -v
Using built-in specs.
COLLECT_GCC=g++
Copy the code

Create a text file and write the following c++ code cplus1.cpp

#include <iostream>
using namespace std;
int main()
{
    cout << "Hello, world!" << endl; return 0; }Copy the code

When going to g++ cplus1. CPP, the a.out executable will be generated, so we’ll use -o to specify the name of the generated executable

G++ cplus1. CPP -o cplus1. /cplus1 output: Hello, world!Copy the code




Install the Java compilation environment

Yum -y install java-devel Java -version openJDK version"1.8.0 comes with _242"
OpenJDK Runtime Environment (build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)
Copy the code

H1.java The class name must be the same as the file name otherwise an error will occur

public class h1{
public static void main(String[] args){
System.out.print("Hello java! \n"); }}Copy the code

run

javac h1.java && java h1
Hello java!
Copy the code

Install conda

Download and install script wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh 1 installation bash execute the script Miniconda3-latest-Linux-x86_64.sh# Read the instructions
# Select the installation directory
/usr/local/miniconda3
# install VScode
Whether to add environment variables
no
Install complete
source /usr/local/ miniconda3 / etc/profile. D/conda. Results sh test installation check version conda - V conda 4.7.12# change to a domestic mirror sourceConda (TUNA) vi ~/. Condarctrue
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

Copy the code

Conda use

conda  activate
Copy the code

Install jupyterlab

2. Run the jupyter Lab installation command: conda install jupyterlab 3. Jupyter lab: jupyter lab: Jupyter notebook: Jupyter notebook [I 21:46:26.903 LabApp] Writes the cookie password of the notebook service to /root/.local/share/jupyter/runtime/notebook_cookie_secret jupyter notebook --generate-config Writing default config to: Py vim /root/.jupyter/jupyter_notebook_config.py will be on line 293#c. notebookapp. token = '
      
       '; #c. notebookapp. token = 'password'
      
c.NotebookApp.token = '<generated>'
c.NotebookApp.ip = '0.0.0.0'C. notebookapp. open_browser = False C. Notebookapp. allow_root=True jupyter lab --allow-root token=ff3f83a43662e499d09fcaf84aa62caa35c8dd90cfb0e4d8 nohup jupyter lab --allow-root &Copy the code

Install the kernel c

If you want to install PIP with conda

conda install pip 
pip install jupyter-c-kernel
cd /usr/local/ miniconda3 / lib/python3.7 / site - packages/jupyter_c_kernel install_c_kernel installation is complete#Installing IPython kernel spectest#include<stdio.h>
int main()
  {
    printf (" py hello c program! \n"); 
    return 0;
   }
shiftEnter executes the output Hello c++!Copy the code

# PIP installed directly

pip3 install jupyter-c-kernel
pip3 show jupyter-c-kernel
cd /usr/local/ python37 / lib/python3.7 / site - packages/jupyter_c_kernel install_c_kernel successful installation Installing IPython kernel specCopy the code

Install the C ++ kernel

Conda install xEUS-CLING -c conda-Forge test#include <iostream>
std::cout << "Hello c++!" << std::endl; Shift enter executes Hello c++!Copy the code

Install the Java kernel

Install JDK later than version 8 mkdir /usr/local/java
tar -xf jdk-13_linux-x64_bin.tar.gz -C /usr/local/java
cd  /usr/local/java
vim /etc/profile
export JAVA_HOME=/usr/local/java/jdk-13
export JRE_HOME=/${JAVA_HOME}
export CLASSPATH=.:${JAVA_HOME}/libss:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

source /etc/profile

# download IjavaWget https://github.com/SpencerPark/IJava/releases/download/v1.2.0/ijava-1.2.0.zip unzip ijava - 1.2.0.zip python install.py --sys-prefix jupyter kernelspec list# restart jupyterlab
pkill -9 jlab 
cd /jupyterlab && nohup jlab &

source  /etc/locale.conf

Copy the code

Image using

Jupyter Password LMKLMK SSH password LMK19980312

The image size is 1.5 GB and includes the compilers for languages such as JUPyterlab conda GCC g++ Java13 PYTHon37

Use # under Windows
docker run -tdi   -p 20022:22  -p 20088:8888  --name   kernel1   --privileged=true  registry.cn-hangzhou.aliyuncs.com/mkmk/conda:v1  init  | docker exec -d  kernel1   /bin/bash -c "cd /home && source /etc/profile && nohup jlab &"


# use under Linux
docker run -tdi   -p 20022:22  -p 20088:8888  --name   kernel1   --privileged=true  registry.cn-hangzhou.aliyuncs.com/mkmk/conda:v1  init  &&  docker exec -d  kernel1   /bin/bash -c "cd /home && source /etc/profile && nohup jlab &"
Copy the code

Click the + sign in the upper left corner to create python, C, C ++, Java language direct programming

Direct programming in addition to JUPyter c, C ++, Java, you can also be in the command line terminal, development projects, click the upper left corner + to create command line

Py c: GCC ctest.c -o ctest&&./ctest c++: g++ cptest. CPP -o cptest&&./cptest Java: javac jtest.java && java jtestCopy the code

Doker common command

# View the mirror list
docker images
# Delete a single mirror
docker rmi image-id
# Delete all mirrors
docker rmi $(docker images -q)
# View the running container
docker ps
# View all containers
docker ps -a
# Stop individual containers
docker stop container-id
# Stop all containers
docker stop $(docker ps -a -q)
Delete a single container
docker rm container-id
Delete all containers
docker rm $(docker ps -a -q)
Delete system data
docker system prune
Copy the code
Windows to empty docker stop $(docker ps - a - q) | docker rm $(docker ps - a - q) | docker rmi $(docker images - q) Linux empty docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q) && docker rmi $(docker images -q)Copy the code

Complete Dockerfile to create centos7 Chinese character set

At this point, can be based on the above methods, to produce a Centos7 mirror support Chinese environment, complete Dockerfile is as follows: the FROM registry.cn-hangzhou.aliyuncs.com/mkmk/conda:v1# Install tools
RUN  yum -y install kde-l10n-Chinese telnet && \
	     yum -y reinstall glibc-common &&\
              yum clean all  && \
                localedef -c -f UTF-8 -i zh_CN zh_CN.utf8 && \
    ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

ENV LANG=zh_CN.UTF-8 \
    LANGUAGE=zh_CN:zh \
    LC_ALL=zh_CN.UTF-8


# Define default command.
CMD ["bash"]
Copy the code
docker build -t registry.cn-hangzhou.aliyuncs.com/mkmk/conda:v2 .
Copy the code