1. 程式人生 > 其它 >Vitis-AI之docker指南

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