MindIE Image Preparation
This section describes how to create a MindIE image package for deploying cluster services.
Setting Up the Environment
Hardware |
Operating System (Recommended) |
|---|---|
Atlas 800I A2 inference server |
Arm: Ubuntu 22.04 |
Atlas 300I Duo inference card+Atlas 800 inference server (model 3000) |
Arm: Ubuntu 20.04 |
Obtaining Software Packages
Software versions required for creating a MindIE image package must meet specific requirements. For details, see Table 1.
Software Type |
Software Package |
Description |
How to Obtain |
|---|---|---|---|
MindIE |
Ascend-mindie_2.3.0_linux-aarch64_abi0.run |
Inference engine package |
|
CANN |
Ascend-cann-toolkit_8.5.0_linux-aarch64.run |
Development kit |
|
NOTE:
Replace 910x and 310x in the preceding software package names with the actual hardware models. |
Binary OPP |
||
Ascend-cann-nnal_8.5.0_linux-aarch64.run |
Acceleration library package |
||
ATB Models |
Ascend-mindie-atb-models_2.3.0_linux-aarch64_torch2.2.0-abi0.tar.gz |
ATB Models installation package |
|
Ascend Extension for PyTorch |
torch_npu-2.1.0.post10-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
WHL package of the torch_npu plugin |
NOTE:
|
torch-2.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
WHL package of PyTorch 2.1.0 |
Prerequisites
- The apt source download path may be incorrect in a new container. You need to configure a dedicated source for Ubuntu 22.04 to improve the download speed.
- The installation requires the download of related dependencies. Ensure that the installation environment can be connected to the network.
- Run the following command to check whether the source is valid.
apt update
If an error is reported during command execution or dependency installation, check whether the network is connected, or replace the source in the /etc/apt/sources.list file with an available source or use an image source. (You can visit Huawei open-source image website to find more information about how to configure a Huawei image source.)
- Docker 24.x.x or later has been installed on the host.
Procedure
The following example describes how to create a MindIE image on an Atlas 800I A2 inference server.
When creating an image, ensure that the ID of the non-root user is the same as the ID of the user who installs the driver in the execution environment. Alternatively, use the --install-for-all option to install the driver for all users.
- Save the software downloaded or made from Obtaining Software Packages to a directory, for example, /home/package.
- Pull the Ubuntu 22.04 image.
docker pull ubuntu:22.04
Check the Ubuntu image.docker images | grep ubuntu
If information similar to the following is printed, the image is successfully pulled:
ubuntu 22.04 981912c48e9a 7 weeks ago 69.2MB
- In the /home/package directory, compile the Dockerfile and other script files required for installation. The file directory structure must be as follows:
├── Ascend-cann-910b-ops_8.5.0_linux-aarch64.run ├── Ascend-cann-nnal_8.5.0_linux-aarch64.run ├── Ascend-cann-toolkit_8.5.0_linux-aarch64.run ├── Ascend-mindie_2.3.0_linux-aarch64_abi0.run ├── Ascend-mindie-atb-models_2.3.0_linux-aarch64_torch2.1.0-abi0.tar.gz ├── docker │ ├── docker_build.sh │ └── Dockerfile ├── install_cann.sh ├── install_mindie.sh ├── install_pta.sh ├── requirements-2.1.0.txt ├── server.js ├── torch_npu-2.1.0.post10-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl └── torch-2.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
The files in bold are user-compiled.
- Compile the docker_build.sh file.
docker build \ --build-arg no_proxy=127.0.0.1,localhost,local,.local,172.17.0.1 \ --build-arg DEVICE=910b \ --build-arg ARCH=aarch64 \ --build-arg CANN_VERSION=8.5.0 \ --build-arg TORCH_VERSION=2.1.0 \ --build-arg MINDIE_VERSION=2.3.0 \ --build-arg PY_VERSION=310 \ -t mindie:2.3.0-aarch64-800I-A2 \ --target mindie .
- DEVICE indicates the hardware model.
- PY_VERSION indicates the Python version number.
- mindie:2.3.0-aarch64-800I-A2 indicates the user-defined image name.
- Compile the Dockerfile.By default, the Dockerfile uses Ubuntu 22.04, AArch, and Python 3.10. It is for reference only and can be modified. (If the image is created based on Ubuntu 24.04, change libgl1-mesa-glx in the Dockerfile to libglx-mesa0.)
# Please make sure all `ARG` have been set correctly # Set the arguments for different images FROM ubuntu:22.04 AS base ARG UBUNTU_VERSION=22.04 ARG ARCH ARG DEVICE LABEL description="Image for ${DEVICE} based on Ubuntu${UBUNTU_VERSION} ${ARCH}" RUN groupadd -g 1000 mindie && \ useradd -u 1000 -g 1000 -m mindieuser ENV PYTHONPATH=/home/mindieuser/.local/lib/python3.10/site-packages:$PATH ENV PATH=/home/mindieuser/.local/bin:$PYTHONPATH RUN echo 'export LD_LIBRARY_PATH=/usr/local/Ascend/driver/lib64/driver:$LD_LIBRARY_PATH' >> /home/mindieuser/.bashrc && \ echo 'export LD_LIBRARY_PATH=/usr/local/Ascend/driver/lib64/common:$LD_LIBRARY_PATH' >> /home/mindieuser/.bashrc && \ echo 'export PYTHONPATH=/home/mindieuser/.local/lib/python3.10/site-packages:$PATH' >> /home/mindieuser/.bashrc && \ echo 'export PATH=/home/mindieuser/.local/bin:$PYTHONPATH' >> /home/mindieuser/.bashrc && \ echo "export LANG=en_US.UTF-8" >> /home/mindieuser/.bashrc && \ echo "export LANGUAGE=en_US:en" >> /home/mindieuser/.bashrc && \ echo "export LC_ALL=en_US.UTF-8" >> /home/mindieuser/.bashrc && \ # Configure the Ubuntu mirror. An example is provided below: apt-get update && \ apt-get install --no-install-recommends -y ca-certificates && \ DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y tzdata && \ apt-get install --no-install-recommends -y gcc g++ make cmake && \ apt-get install --no-install-recommends -y zlib1g zlib1g-dev libbz2-dev liblzma-dev libffi-dev libssl-dev openssl libsqlite3-dev && \ apt-get install --no-install-recommends -y libblas-dev liblapack-dev libopenblas-dev libblas3 liblapack3 gfortran libhdf5-dev && \ apt-get install --no-install-recommends -y wget curl pkg-config vim libxml2 libxslt1-dev locales && \ apt-get install --no-install-recommends -y pciutils net-tools ipmitool numactl linux-tools-common && \ apt-get install --no-install-recommends -y libgl1-mesa-glx libgmpxx4ldbl && \ apt-get install --no-install-recommends -y xz-utils unzip && \ apt-get install --no-install-recommends -y python3-pip python-is-python3 && \ # Configure the pip mirror. An example is provided below: # pip config --user set global.index https://mirrors.tools.huawei.com/pypi && \ # pip config --user set global.index-url https://mirrors.tools.huawei.com/pypi/simple && \ # pip config --user set global.trusted-host mirrors.tools.huawei.com && \ locale-gen en_US.UTF-8 WORKDIR /home/mindieuser USER mindieuser ENV TZ=Asia/Shanghai ####################################################################################### # docker build -t cann --target cann . ####################################################################################### FROM base AS cann ARG DEVICE ARG ARCH ARG CANN_VERSION RUN echo "source /home/mindieuser/Ascend/cann/set_env.sh" >> /home/mindieuser/.bashrc && \ echo "source /home/mindieuser/Ascend/nnal/atb/set_env.sh" >> /home/mindieuser/.bashrc && \ wget -q http://172.17.0.1:3000/Ascend-cann-toolkit_${CANN_VERSION}_linux-${ARCH}.run -P /home/mindieuser/package/ && \ wget -q http://172.17.0.1:3000/Ascend-cann-${DEVICE}-ops_${CANN_VERSION}_linux-${ARCH}.run -P /home/mindieuser/package/ && \ wget -q http://172.17.0.1:3000/Ascend-cann-nnal_${CANN_VERSION}_linux-${ARCH}.run -P /home/mindieuser/package/ && \ wget -q http://172.17.0.1:3000/install_cann.sh -P /home/mindieuser/package/ && \ cd /home/mindieuser/package && \ bash install_cann.sh && \ rm -rf /home/mindieuser/package/* ####################################################################################### # docker build -t pta --target pta . ####################################################################################### FROM cann AS pta ARG DEVICE ARG ARCH ARG TORCH_VERSION RUN wget -q http://172.17.0.1:3000/torch_npu-${TORCH_VERSION}.post10-cp310-cp310-manylinux_2_17_${ARCH}.manylinux2014_${ARCH}.whl -P /home/mindieuser/package/ && \ wget -q http://172.17.0.1:3000/torch-${TORCH_VERSION}-cp310-cp310-manylinux_2_17_${ARCH}.manylinux2014_${ARCH}.whl -P /home/mindieuser/package/ && \ wget -q http://172.17.0.1:3000/requirements-${TORCH_VERSION}.txt -P /home/mindieuser/package/ && \ wget -q http://172.17.0.1:3000/install_pta.sh -P /home/mindieuser/package/ && \ cd /home/mindieuser/package && \ pip install -r requirements-${TORCH_VERSION}.txt --no-cache-dir && \ bash install_pta.sh && \ pip cache purge && \ rm -rf /home/mindieuser/package/* ####################################################################################### # docker build -t mindie --target mindie . ####################################################################################### FROM pta AS mindie ARG DEVICE ARG ARCH ARG TORCH_VERSION ARG MINDIE_VERSION RUN echo "source /home/mindieuser/Ascend/mindie/set_env.sh" >> /home/mindieuser/.bashrc && \ echo "source /home/mindieuser/Ascend/atb-models/set_env.sh" >> /home/mindieuser/.bashrc && \ wget -q http://172.17.0.1:3000/Ascend-mindie_${MINDIE_VERSION}_linux-${ARCH}_abi0.run -P /home/mindieuser/package/ && \ wget -q http://172.17.0.1:3000/Ascend-mindie-atb-models_${MINDIE_VERSION}_linux-${ARCH}_py310_torch${TORCH_VERSION}-abi0.tar.gz -P /home/mindieuser/package/ && \ wget -q http://172.17.0.1:3000/install_mindie.sh -P /home/mindieuser/package/ && \ cd /home/mindieuser/package && \ bash install_mindie.sh && \ pip cache purge && \ rm -rf /home/mindieuser/package/*
- The software package name in the Dockerfile must be the actual one.
- During the pta build phase, you can specify the version of the Transformers library because certain models have strict version requirements. In the Dockerfile example, the location for changing the related code is provided. The modification made during the build phase allows the inference service to start directly after the image is built, without needing to enter the container.
- The current version also adapts to Python 3.11.4. The following describes how to make modifications with Python 3.11.4 used.
- Download the Python 3.11.4 package from the Python official website using the following link.
https://www.python.org/ftp/python/3.11.4/Python-3.11.4.tgz
- Move the obtained Python 3.11.4 package to the /home/package directory.
- In the Dockerfile, replace the base-layer build command and modify the content related to the Python version in the script.
FROM ubuntu:22.04 AS base ARG UBUNTU_VERSION=22.04 ARG PYTHON_VERSION=3.11.4 # Set python version ARG ARCH ARG DEVICE LABEL description="Image for ${DEVICE} based on Ubuntu${UBUNTU_VERSION} ${ARCH}" RUN groupadd -g 1000 mindie && \ useradd -u 1000 -g 1000 -m mindieuser ENV PYTHONPATH=/home/mindieuser/.local/lib/python3.10/site-packages:$PATH ENV PATH=/home/mindieuser/.local/bin:$PYTHONPATH ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" RUN echo 'export LD_LIBRARY_PATH=/usr/local/Ascend/driver/lib64/driver:$LD_LIBRARY_PATH' >> /home/mindieuser/.bashrc && \ echo 'export LD_LIBRARY_PATH=/usr/local/Ascend/driver/lib64/common:$LD_LIBRARY_PATH' >> /home/mindieuser/.bashrc && \ echo 'export PYTHONPATH=/home/mindieuser/.local/lib/python3.11.4/site-packages:$PATH' >> /home/mindieuser/.bashrc && \ echo 'export PATH=/home/mindieuser/.local/bin:$PYTHONPATH' >> /home/mindieuser/.bashrc && \ echo "export LANG=en_US.UTF-8" >> /home/mindieuser/.bashrc && \ echo "export LANGUAGE=en_US:en" >> /home/mindieuser/.bashrc && \ echo "export LC_ALL=en_US.UTF-8" >> /home/mindieuser/.bashrc && \ # Configure the Ubuntu mirror. An example is provided below: apt-get update && \ apt-get install --no-install-recommends -y ca-certificates && \ DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y tzdata && \ apt-get install --no-install-recommends -y gcc g++ make cmake && \ apt-get install --no-install-recommends -y zlib1g zlib1g-dev libbz2-dev liblzma-dev libffi-dev libssl-dev openssl libsqlite3-dev && \ apt-get install --no-install-recommends -y libblas-dev liblapack-dev libopenblas-dev libblas3 liblapack3 gfortran libhdf5-dev && \ apt-get install --no-install-recommends -y wget curl pkg-config vim libxml2 libxslt1-dev locales && \ apt-get install --no-install-recommends -y pciutils net-tools ipmitool numactl linux-tools-common && \ apt-get install --no-install-recommends -y libgl1-mesa-glx libgmpxx4ldbl && \ apt-get install --no-install-recommends -y xz-utils unzip && \ wget -q http://172.17.0.1:3000/Python-$PYTHON_VERSION.tgz -P /opt/package/ && \ cd /opt/package && \ tar -xf Python-$PYTHON_VERSION.tgz && \ cd Python-$PYTHON_VERSION && \ ./configure --enable-optimizations --enable-shared --enable-loadable-sqlite-extensions --with-lto --with-ensurepip --with-computed-gotos && \ make -j$(nproc) && \ make altinstall && \ cd .. && \ rm -rf Python-$PYTHON_VERSION Python-$PYTHON_VERSION.tgz && \ ln -sf /usr/local/bin/python3.11 /usr/bin/python3 && \ ln -sf /usr/local/bin/python3.11 /usr/bin/python && \ python -m ensurepip --default-pip && \ ln -sf /usr/local/bin/pip3.11 /usr/bin/pip3 && \ ln -sf /usr/local/bin/pip3.11 /usr/bin/pip && \ # Configure the pip mirror. An example is provided below: # pip config --user set global.index https://mirrors.tools.huawei.com/pypi && \ # pip config --user set global.index-url https://mirrors.tools.huawei.com/pypi/simple && \ # pip config --user set global.trusted-host mirrors.tools.huawei.com && \ locale-gen en_US.UTF-8 WORKDIR /home/mindieuser USER mindieuser ENV TZ=Asia/Shanghai
- Download the Python 3.11.4 package from the Python official website using the following link.
- Compile the install_cann.sh file.
#!/bin/bash CANN_TOOKIT="Ascend-cann-toolkit_*_linux-*.run" CANN_OPS="Ascend-cann-*-ops_*_linux-*.run" CANN_NNAL="Ascend-cann-nnal_*_linux-*.run" chmod +x *.run yes | ./${CANN_TOOKIT} --install --quiet toolkit_status=$? if [ ${toolkit_status} -eq 0 ]; then echo "install toolkit successfully" else echo "install toolkit failed with status ${toolkit_status}" fi yes | ./${CANN_OPS} --install --quiet ops_status=$? if [ ${ops_status} -eq 0 ]; then echo "install ops successfully" else echo "install ops failed with status ${ops_status}" fi source /home/mindieuser/Ascend/cann/set_env.sh yes | ./${CANN_NNAL} --install --quiet nnal_status=$? if [ ${nnal_status} -eq 0 ]; then echo "install nnal successfully" else echo "install nnal failed with status ${nnal_status}" fi - Compile the install_mindie.sh file.
#!/bin/bash source /home/mindieuser/Ascend/cann/set_env.sh mkdir -p /home/mindieuser/Ascend/atb-models MINDIE="Ascend-mindie_*_linux-*.run" MODEL="Ascend-mindie-atb-models_*_linux-aarch64_py310_torch2.1.0-abi0.tar.gz" chmod +x *.run tar -xzf ./${MODEL} -C /home/mindieuser/Ascend/atb-models yes | ./${MINDIE} --install --quiet 2> /dev/null mindie_status=$? if [ ${mindie_status} -eq 0 ]; then echo "install mindie successfully" else echo "install mindie failed with status ${mindie_status}" fi - Compile the install_pta.sh file.
#!/bin/bash pip3 install torch-2.1.0-cp310-cp310-manylinux_2_17_*.manylinux2014_*.whl TORCH_NPU_IN_PYTORCH_MANYLINUX=torch_npu-2.1.0*aarch64.whl echo "start install torch_npu, wait for a minute..." pip install ${TORCH_NPU_IN_PYTORCH_MANYLINUX} - Compile the requirements-2.1.0.txt file.
# # This file is autogenerated by pip-compile with Python 3.10 # by the following command: # # pip-compile absl-py==2.1.0 # via rouge-score accelerate==0.34.2 # via -r requirements.in annotated-types==0.7.0 # via pydantic attrs==24.2.0 # via jsonlines brotli==1.1.0 # via geventhttpclient certifi==2024.8.30 # via # geventhttpclient # requests cffi==1.17.1 # via -r requirements.in charset-normalizer==3.3.2 # via requests click==8.1.7 # via nltk cloudpickle==3.0.0 # via -r requirements.in colorama==0.4.6 # via sacrebleu contourpy==1.3.0 # via matplotlib cpm-kernels==1.0.11 # via -r requirements.in cycler==0.12.1 # via matplotlib decorator==5.1.1 # via -r requirements.in et-xmlfile==1.1.0 # via openpyxl filelock==3.16.1 # via # huggingface-hub # icetk # torch # transformers fonttools==4.54.1 # via matplotlib fsspec==2024.9.0 # via # huggingface-hub # torch fuzzywuzzy==0.18.0 # via -r requirements.in gevent==24.2.1 # via geventhttpclient geventhttpclient==2.3.1 # via -r requirements.in greenlet==3.1.1 # via gevent grpcio==1.66.1 # via tritonclient huggingface-hub==0.25.1 # via # accelerate # tokenizers # transformers icetk==0.0.4 # via -r requirements.in idna==3.10 # via requests jieba==0.42.1 # via -r requirements.in jinja2==3.1.4 # via torch joblib==1.4.2 # via nltk jsonlines==4.0.0 # via -r requirements.in kiwisolver==1.4.7 # via matplotlib latex2mathml==3.77.0 # via mdtex2html loguru==0.7.2 # via -r requirements.in lxml==5.3.0 # via sacrebleu markdown==3.7 # via mdtex2html markupsafe==2.1.5 # via jinja2 matplotlib==3.9.2 # via -r requirements.in mdtex2html==1.3.0 # via -r requirements.in ml-dtypes==0.5.0 # via -r requirements.in mpmath==1.3.0 # via sympy networkx==3.3 # via torch nltk==3.9.1 # via rouge-score numpy==1.26.4 # via # -r requirements.in # accelerate # contourpy # matplotlib # ml-dtypes # pandas # pyarrow # rouge-score # sacrebleu # scipy # torchvision # transformers # tritonclient openpyxl==3.1.5 # via -r requirements.in packaging==24.1 # via # accelerate # huggingface-hub # matplotlib # transformers # tritonclient pandas==2.2.3 # via -r requirements.in pathlib2==2.3.7.post1 # via -r requirements.in pillow==10.4.0 # via # matplotlib # torchvision portalocker==2.10.1 # via sacrebleu prettytable==3.11.0 # via -r requirements.in protobuf==3.20.0 # via # -r requirements.in # tritonclient psutil==6.0.0 # via accelerate pyarrow==17.0.0 # via -r requirements.in pycparser==2.22 # via cffi pydantic==2.9.2 # via -r requirements.in pydantic-core==2.23.4 # via pydantic pyparsing==3.1.4 # via matplotlib python-dateutil==2.9.0.post0 # via # matplotlib # pandas python-rapidjson==1.20 # via tritonclient pytz==2024.2 # via pandas pyyaml==6.0.2 # via # accelerate # huggingface-hub # transformers rapidfuzz==3.10.0 # via thefuzz regex==2024.9.11 # via # nltk # sacrebleu # tiktoken # transformers requests==2.32.3 # via # huggingface-hub # icetk # tiktoken # torchvision # transformers rouge==1.0.1 # via -r requirements.in rouge-score==0.1.2 # via -r requirements.in sacrebleu==2.4.3 # via -r requirements.in safetensors==0.4.5 # via # accelerate # transformers scipy==1.14.1 # via -r requirements.in sentencepiece==0.2.0 # via icetk six==1.16.0 # via # pathlib2 # python-dateutil # rouge # rouge-score sympy==1.13.3 # via torch tabulate==0.9.0 # via sacrebleu termcolor==2.4.0 # via -r requirements.in thefuzz==0.22.1 # via -r requirements.in tiktoken==0.7.0 # via -r requirements.in tokenizers==0.19.1 # via transformers torch==2.1.0 # via # -r requirements.in # accelerate # torchvision torchvision==0.16.0 # via icetk tornado==6.4.1 # via -r requirements.in tqdm==4.66.5 # via # huggingface-hub # icetk # nltk # transformers transformers==4.44.0 # via -r requirements.in tritonclient[grpc]==2.49.0 # via -r requirements.in typing-extensions==4.12.2 # via # huggingface-hub # pydantic # pydantic-core # torch tzdata==2024.2 # via pandas urllib3==2.2.3 # via # geventhttpclient # requests # tritonclient wcwidth==0.2.13 # via prettytable wheel==0.44.0 # via -r requirements.in zope-event==5.0 # via gevent zope-interface==7.0.3 # via gevent # The following packages are considered to be unsafe in a requirements file: # setuptools - Compile the server.js file.
const http = require('http'); const fs = require('fs'); const path = require('path'); const port = 3000; const directory = __dirname; const server = http.createServer((req, res) => { const filePath = path.join(directory, req.url); if (req.url ==='/files') { // return all file names in current directory fs.readdir(directory, (err, files)=> { if (err) { res.writeHead(500, {'Content-Type': 'text/plain'}); res.end('Internal Server Error\n'); return; } res.writeHead(200, {'Content-Type': 'application/json'}); res.end(JSON.stringify(files)); }); }else { fs.stat(filePath, (err, stats) => { if (err || !stats.isFile()) { res.writeHead(404, { 'Content-Type': 'text/plain' }); res.end('Not Found\n'); return; } fs.createReadStream(filePath).pipe(res); }); } }); server.listen(port, () => { console.log(`Server is running at http://localhost:${port}`); });
- During image creation, pay attention to the security of the third-party software on which the image depends. If there is any problem, update the software and fix the problem in a timely manner.
- Key information in the Dockerfile:
- Image source. At the beginning of the Dockerfile, you can set the apt source of Ubuntu. Adjust the address as needed, using the provided one as a reference only.
- pip source: You can set the pip source to a proper address in the Dockerfile to speed up image build.
- wget command: Use the wget command instead of the COPY command to move files from the host to the container. For details, see 4. http://172.17.0.1:3000 indicates the address of the host on the Docker network and does not need to be changed. For example, you can run the following command to use Toolkit on the host for build:
wget -q http://172.17.0.1:3000/Ascend-cann-toolkit_${CANN_VERSION}_linux-${ARCH}.run -P /opt/package/
- Compile the docker_build.sh file.
- Start server.js on the host.
- Ensure that Node.js has been installed on the host for starting the service.If the host runs Ubuntu, run the following command to install Node.js:
apt install nodejs
- Run the following commands in the build environment:
cd /home/package # Go to the build directory. node server.js
- If the following information is displayed, the service is started successfully.
Server is running at http://localhost:3000
Keep this CLI, and close it until the build is complete.
- The service is started to allow the corresponding software package to be obtained during the image build process. The wget command in Dockerfile is equivalent to the COPY command. For details, see 3.
- The preceding method can reduce the image size from over 20 GB to approximately 13 GB and decrease the build time by minimizing the time required to load the build context. If you do not want to use this method, you can use the native COPY command of Docker and place the Dockerfile and all dependencies in the same directory to form the build context.
- Ensure that Node.js has been installed on the host for starting the service.
- Create a CLI (do not close the CLI in step 4), go to the docker directory, and build the image.
cd /home/package/docker # Go to the docker directory. bash docker_build.sh
After the image is built, information similar to the following is printed:
[+] Building 798.2s (9/9) FINISHED docker:default => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 6.12kB 0.0s => [internal] load metadata for docker.io/library/ubuntu:22.04 0.0s => CACHED [base 1/2] FROM docker.io/library/ubuntu:22.04 0.0s => [base 2/2] RUN echo 'export LD_LIBRARY_PATH=/usr/local/Ascend/driver/lib64/driver:$LD_LIBRARY_PATH' >> /root/.bashrc && echo 'export LD_LIBRARY_PATH=/usr/local/Ascend/drive 187.2s => [cann 1/1] RUN echo "source /usr/local/Ascend/cann/set_env.sh" >> /home/mindieuser/.bashrc && echo "source /usr/local/Ascend/nnal/atb/set_env.sh" >> /home/mindieuser/.bashrc && wget 274.4s => [pta 1/1] RUN wget -q http://172.17.0.1:3000/torch_npu-2.1.0.post8-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -P /opt/package/ && wget -q http://172.17.0. 272.9s => [mindie 1/1] RUN echo "source /usr/local/Ascend/mindie/set_env.sh" >> /home/mindieuser/.bashrc && echo "source /usr/local/Ascend/atb-models/set_env.sh" >> /home/mindieuser/.bashrc && wget -q 31.6s => exporting to image 31.9s => => exporting layers 31.9s => => writing image sha256:ddc1229a39be3e2b9f2d0d88e809a4dc2db17ac9ec67c4c178c21fe1359eb6d7 0.0s => => naming to docker.io/library/mindie:2.3.0-aarch64-800I-A2 0.0s
Then, run the following command:
docker images
If the following information is displayed, the image is successfully built:
1 2
REPOSITORY TAG IMAGE ID CREATED SIZE mindie 2.3.0-aarch64-800I-A2 ddc1229a39be About a minute ago 12.3GB