天天看點

初試Docker desktop與OpenVINO DL Workbench的使用入門

你可以使用WIN+R 輸入powershell啟動powershell,也可以用anaconda的powershell 快捷方式,我選擇用anaconda-powershell,進入指令界面後開始測試

(base) PS C:\Users\space> docker --version

Docker version 19.03.8, build afacb8b

(base) PS C:\Users\space> docker run hello-world

Unable to find image 'hello-world:latest' locally

latest: Pulling from library/hello-world

0e03bdcc26d7: Pull complete                                                                                             Digest: sha256:d58e752213a51785838f9eed2b7a498ffa1cb3aa7f946dda11af39286c3db9a9

Status: Downloaded newer image for hello-world:latest

Hello from Docker!

This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:

 1. The Docker client contacted the Docker daemon.

 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.

    (amd64)

 3. The Docker daemon created a new container from that image which runs the

    executable that produces the output you are currently reading.

 4. The Docker daemon streamed that output to the Docker client, which sent it

    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:

 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:

 https://hub.docker.com/

For more examples and ideas, visit:

 https://docs.docker.com/get-started/

(base) PS C:\Users\space> docker --help

Usage:  docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Options:

      --config string      Location of client config files (default

                           "C:\\Users\\space\\.docker")

  -c, --context string     Name of the context to use to connect to the

                           daemon (overrides DOCKER_HOST env var and

                           default context set with "docker context use")

  -D, --debug              Enable debug mode

  -H, --host list          Daemon socket(s) to connect to

  -l, --log-level string   Set the logging level

                           ("debug"|"info"|"warn"|"error"|"fatal")

                           (default "info")

      --tls                Use TLS; implied by --tlsverify

      --tlscacert string   Trust certs signed only by this CA (default

                           "C:\\Users\\space\\.docker\\ca.pem")

      --tlscert string     Path to TLS certificate file (default

                           "C:\\Users\\space\\.docker\\cert.pem")

      --tlskey string      Path to TLS key file (default

                           "C:\\Users\\space\\.docker\\key.pem")

      --tlsverify          Use TLS and verify the remote

  -v, --version            Print version information and quit

Management Commands:

  builder     Manage builds

  config      Manage Docker configs

  container   Manage containers

  context     Manage contexts

  image       Manage images

  network     Manage networks

  node        Manage Swarm nodes

  plugin      Manage plugins

  secret      Manage Docker secrets

  service     Manage services

  stack       Manage Docker stacks

  swarm       Manage Swarm

  system      Manage Docker

  trust       Manage trust on Docker images

  volume      Manage volumes

Commands:

  attach      Attach local standard input, output, and error streams to a running container

  build       Build an image from a Dockerfile

  commit      Create a new image from a container's changes

  cp          Copy files/folders between a container and the local filesystem

  create      Create a new container

  diff        Inspect changes to files or directories on a container's filesystem

  events      Get real time events from the server

  exec        Run a command in a running container

  export      Export a container's filesystem as a tar archive

  history     Show the history of an image

  images      List images

  import      Import the contents from a tarball to create a filesystem image

  info        Display system-wide information

  inspect     Return low-level information on Docker objects

  kill        Kill one or more running containers

  load        Load an image from a tar archive or STDIN

  login       Log in to a Docker registry

  logout      Log out from a Docker registry

  logs        Fetch the logs of a container

  pause       Pause all processes within one or more containers

  port        List port mappings or a specific mapping for the container

  ps          List containers

  pull        Pull an image or a repository from a registry

  push        Push an image or a repository to a registry

  rename      Rename a container

  restart     Restart one or more containers

  rm          Remove one or more containers

  rmi         Remove one or more images

  run         Run a command in a new container

  save        Save one or more images to a tar archive (streamed to STDOUT by default)

  search      Search the Docker Hub for images

  start       Start one or more stopped containers

  stats       Display a live stream of container(s) resource usage statistics

  stop        Stop one or more running containers

  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE

  top         Display the running processes of a container

  unpause     Unpause all processes within one or more containers

  update      Update configuration of one or more containers

  version     Show the Docker version information

  wait        Block until one or more containers stop, then print their exit codes

Run 'docker COMMAND --help' for more information on a command.

(base) PS C:\Users\space> docker image ls

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

hello-world         latest              bf756fb1ae65        5 months ago        13.3kB

(base) PS C:\Users\space> docker container ls --all

CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS                          PORTS               NAMES

447ed27e3e03        hello-world         "/hello"            About a minute ago   Exited (0) About a minute ago                       trusting_neumann

(base) PS C:\Users\space> docker run --interactive --tty ubuntu bash

Unable to find image 'ubuntu:latest' locally

latest: Pulling from library/ubuntu

a4a2a29f9ba4: Pull complete  

127c9761dcba: Pull complete

13bf203e905: Pull complete  

039240d2e0b: Pull complete

Digest: sha256:35c4a2c15539c6c1e4e5fa4e554dac323ad0107d8eb5c582d6ff386b383b7dce

Status: Downloaded newer image for ubuntu:latest

root@22583a1d1487:/#   

用exit指令退出,沒有quit指令

root@22583a1d1487:/# quit

bash: quit: command not found

root@22583a1d1487:/# exit

exit

(base) PS C:\Users\space>

關于設定這裡就不多說了,因為docker desktop有圖形化的設定界面,很容易找到各個要設定的選項。

根據OpenVINO官方文檔

參考:https://docs.openvinotoolkit.org/latest/_docs_Workbench_DG_Install_from_Docker_Hub.html#windows

在ubuntu和windows下的操作稍有不同,但大同小異,我以windows為例,

首先,打開powershell 指令視窗,輸入指令

如果一切正常的話,docker會幫你把檔案包從Docker Hub上拉到本地,大概結果如下,

這時,系統提示你可以進入伺服器了,打開浏覽器,輸入

http://127.0.0.1:5665.

可以看到OpenVINO workbench界面,

在指令視窗按Ctrl + C (事際上我是先後用Ctrl + Z  ---- Ctrl + C)可以停止workbench服務。

然後在指令視窗建立檔案夾:

mkdir C:\workbench

根據官網的說法,再運作

報錯:沖突,已經在使用中:

PS C:\Users\space> docker run -p 127.0.0.1:5665:5665 --name workbench  --volume /C/workbench:/home/openvino/.workbench -d openvino/workbench:latest

C:\Program Files\Docker\Docker\resources\bin\docker.exe: Error response from daemon: Conflict. The container name "/workbench" is already in use by container "4e283c7e0bd2397f32ec7413543574d74f55602c913630462c46b121aeba35b4". You have to remove (or rename) that container to be able to reuse that name.

See 'C:\Program Files\Docker\Docker\resources\bin\docker.exe run --help'.

PS C:\Users\space>

下面是我的處理方法,

(1)先檢視一下目前狀态

PS C:\Users\space> docker ps -a

CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS                     PORTS                      NAMES

4e283c7e0bd2        openvino/workbench:latest   "bash /opt/intel/ope…"   2 hours ago         Up 2 hours                 127.0.0.1:5665->5665/tcp   workbench

22583a1d1487        ubuntu                      "bash"                   2 hours ago         Exited (127) 2 hours ago                              romantic_cannon

447ed27e3e03        hello-world                 "/hello"                 2 hours ago         Exited (0) 2 hours ago                                trusting_neumann

(2)這時候執行docker rm是不成功的,

PS C:\Users\space> docker rm 4e283c

Error response from daemon: You cannot remove a running container 4e283c7e0bd2397f32ec7413543574d74f55602c913630462c46b121aeba35b4. Stop the container before attempting removal or force remove

(3)這時隻能先用docker stop停止服務

PS C:\Users\space> docker stop 4e283c

4e283c

(4)然後再移除該container才可以,

(5)這樣,就可以順利重新啟動container了,

b26f548fbdca3f6ed2fcb140c438d9cd48f96bb27f07f66e4f09391374db617b

當然,假設不用docker rm的話,用docker start ...也是可以的,官網裡并沒有具體介紹,我通常就是這麼幹的。另外,特别注意,那個登陸的token不會再在powershell指令視窗顯示,現在已經儲存到這裡了,

C:\workbench\token.txt

最後,曬一張登陸成功的圖檔吧!

初試Docker desktop與OpenVINO DL Workbench的使用入門