Vitis-AI之docker指南

由于网络原因,有时候进入docker官网时候很卡,故摘录一部分安装要点,供自己查阅参考
docker安装原文链接:https://docs.docker.com/engine/install/ubuntu/#uninstall-docker-engine docker权限设置原文链接:https://docs.docker.com/engine/install/linux-postinstall/
强烈建议看原文安装!!!看原文!!!非常全面!!!

安装环境要求

1.1To install Docker Engine, you need the 64-bit version of one of these Ubuntu versions:

Ubuntu Impish 21.10
Ubuntu Hirsute 21.04
Ubuntu Focal 20.04 (LTS)
Ubuntu Bionic 18.04 (LTS)

1.2 安装之前卸载旧版本

sudo apt-get remove docker docker-engine docker.io containerd runc
It’s OK if apt-get reports that none of these packages are installed.
The contents of /var/lib/docker/, including images, containers, volumes, and networks, are preserved. If you do not need to save your existing data, and want to start with a clean installation, refer to the uninstall Docker Engine section at the bottom of this page.

Uninstall Docker Engine
Uninstall the Docker Engine, CLI, and Containerd packages:

sudo apt-get purge docker-ce docker-ce-cli containerd.io
Images, containers, volumes, or customized configuration files on your host are not automatically removed. To delete all images, containers, and volumes:
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd

You must delete any edited configuration files manually.

2.开始安装(在线安装)

(采用命令行在线安装,网络不好也可以根据官方手册选择.deb离线安装的方式)

2.1 Install using the repository

Update the apt package index and install packages to allow apt to use a repository over HTTPS:

 sudo apt-get update
 sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

Add Docker’s official GPG key:

 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Use the following command to set up the stable repository. To add the nightly or test repository, add the word nightly or test (or both) after the word stable in the commands below. Learn about nightly and test channels.

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

2.2 Install Docker Engine

一定要选择19.03以上的版本,否则不支持DPU docker!!!,后续又要重新升级,很麻烦。。。

 sudo apt-get update
 sudo apt-get install docker-ce docker-ce-cli containerd.io

To install a specific version of Docker Engine, list the available versions in the repo, then select and install:

apt-cache madison docker-ce
sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

test

sudo docker run hello-world

3设置权限

3.1Create the docker group.

sudo groupadd docker

3.2 Add your user to the docker group

sudo usermod -aG docker $USER

3.3测试部分

Log out and log back in so that your group membership is re-evaluated.

If testing on a virtual machine, it may be necessary to restart the virtual machine for changes to take effect.

On a desktop Linux environment such as X Windows, log out of your session completely and then log back in.

On Linux, you can also run the following command to activate the changes to groups:

newgrp docker
Verify that you can run docker commands without sudo.

docker run hello-world

4 安装xilinx GPU版本的docker

4.进入https://github.com/Xilinx/Vitis-AI按照教程安装完之后,启动运行的时候报错:

docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]].

2解决方案
这是由于没有配置好docker运行环境导致的,执行安装容器运行环境(以Ubuntu18.04为例)
执行命令:

sudo apt-get update
sudo apt-get install nvidia-container-runtime
systemctl restart docker


posted @ 2021-12-14 16:30  冰峰漫步  阅读(1057)  评论(0编辑  收藏  举报