RUN_IN_DOCKER.md 3.1 KB
Newer Older
1 2
# How to run PaddleServing in Docker

B
barrierye 已提交
3
([简体中文](RUN_IN_DOCKER_CN.md)|English)
B
fix doc  
barrierye 已提交
4

5 6
One of the biggest benefits of Docker is portability, which can be deployed on multiple operating systems and mainstream cloud computing platforms. The Paddle Serving Docker image can be deployed on Linux, Mac and Windows platforms.

7 8 9 10
## Requirements

Docker (GPU version requires nvidia-docker to be installed on the GPU machine)

B
barrierye 已提交
11 12
This document takes Python2 as an example to show how to run Paddle Serving in docker. You can also use Python3 to run related commands by replacing `python` with `python3`.

13 14 15 16
## CPU

### Get docker image

B
barrierye 已提交
17
Refer to [this document](DOCKER_IMAGES.md) for a docker image:
18

B
barrierye 已提交
19
```shell
W
wangjiawei04 已提交
20
docker pull registry.baidubce.com/paddlepaddle/serving:latest-devel
B
barrierye 已提交
21
```
22

B
barrierye 已提交
23

24 25 26
### Create container

```bash
W
wangjiawei04 已提交
27
docker run -p 9292:9292 --name test -dit registry.baidubce.com/paddlepaddle/serving:latest-devel
28 29 30 31 32 33 34
docker exec -it test bash
```

The `-p` option is to map the `9292` port of the container to the `9292` port of the host.

### Install PaddleServing

W
wangjiawei04 已提交
35
The mirror comes with `paddle_serving_server`, `paddle_serving_client`, and `paddle_serving_app` corresponding to the mirror tag version. If users don’t need to change the version, they can use it directly, which is suitable for environments without extranet services.
36

W
wangjiawei04 已提交
37
If you need to change the version, please refer to the instructions on the homepage to download the pip package of the corresponding version.
38 39 40 41 42 43 44 45
  

## GPU

The GPU version is basically the same as the CPU version, with only some differences in interface naming (GPU version requires nvidia-docker to be installed on the GPU machine).

### Get docker image

B
barrierye 已提交
46
Refer to [this document](DOCKER_IMAGES.md) for a docker image, the following is an example of an `cuda9.0-cudnn7` image:
47

B
barrierye 已提交
48
```shell
W
wangjiawei04 已提交
49
docker pull registry.baidubce.com/paddlepaddle/serving:latest-cuda10.2-cudnn8-devel
B
barrierye 已提交
50
```
51 52 53 54

### Create container

```bash
W
wangjiawei04 已提交
55
nvidia-docker run -p 9292:9292 --name test -dit registry.baidubce.com/paddlepaddle/serving:latest-cuda10.2-cudnn8-devel
56 57 58
nvidia-docker exec -it test bash
```

W
wangjiawei04 已提交
59
or
60 61

```bash
W
wangjiawei04 已提交
62
docker run --gpus all -p 9292:9292 --name test -dit registry.baidubce.com/paddlepaddle/serving:latest-cuda10.2-cudnn8-devel
W
wangjiawei04 已提交
63
docker exec -it test bash
64 65
```

W
wangjiawei04 已提交
66
The `-p` option is to map the `9292` port of the container to the `9292` port of the host.
67

W
wangjiawei04 已提交
68
### Install PaddleServing
B
barrierye 已提交
69

W
wangjiawei04 已提交
70
The mirror comes with `paddle_serving_server_gpu`, `paddle_serving_client`, and `paddle_serving_app` corresponding to the mirror tag version. If users don’t need to change the version, they can use it directly, which is suitable for environments without extranet services.
B
barrierye 已提交
71

W
wangjiawei04 已提交
72
If you need to change the version, please refer to the instructions on the homepage to download the pip package of the corresponding version. [LATEST_PACKAGES](./LATEST_PACKAGES.md)
B
barrierye 已提交
73

W
wangjiawei04 已提交
74
## Precautious
B
barrierye 已提交
75

W
wangjiawei04 已提交
76 77
- Runtime images cannot be used for compilation. If you want to compile from source, refer to [COMPILE](COMPILE.md).
- If you use Cuda9 and Cuda10 docker images, you cannot use `paddle_serving_server` CPU version at the same time, due to the limitation of gcc version. If you want to use both in one docker image, please choose images of Cuda10.1, Cuda10.2 and Cuda11.