Skip to content

Commit 1c8a2ec

Browse files
Helin Wangreyoung
authored andcommitted
update docker install English version
1 parent 8ce0008 commit 1c8a2ec

File tree

1 file changed

+32
-43
lines changed

1 file changed

+32
-43
lines changed

doc/getstarted/build_and_install/docker_install_en.rst

Lines changed: 32 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,20 @@ Docker is simple as long as we understand a few basic concepts:
5353
Usage of CPU-only and GPU Images
5454
----------------------------------
5555

56-
For each version of PaddlePaddle, we release two types of Docker images:
57-
development image and production image. Production image includes
58-
CPU-only version and a CUDA GPU version and their no-AVX versions. We
59-
put the docker images on `dockerhub.com
56+
We package PaddlePaddle's compile environment into a Docker image,
57+
called the develop image, it contains all compiling tools that
58+
PaddlePaddle needs. We package compiled PaddlePaddle program into a
59+
Docker image as well, called the production image, it contains all
60+
runtime environment that running PaddlePaddle needs. For each version
61+
of PaddlePaddle, we release both of them. Production image includes
62+
CPU-only version and a CUDA GPU version and their no-AVX versions.
63+
64+
We put the docker images on `dockerhub.com
6065
<https://hub.docker.com/r/paddledev/paddle/>`_. You can find the
61-
latest versions under "tags" tab at dockerhub.com
66+
latest versions under "tags" tab at dockerhub.com. If you are in
67+
China, you can use our Docker image registry mirror to speed up the
68+
download process. To use it, please replace all paddlepaddle/paddle in
69+
the commands to docker.paddlepaddle.org/paddle.
6270

6371
1. Production images, this image might have multiple variants:
6472

@@ -179,59 +187,40 @@ Develop PaddlePaddle or Train Model Using C++ API
179187
We will be using PaddlePaddle development image since it contains all
180188
compiling tools and dependencies.
181189

182-
Let's clone PaddlePaddle repo first:
190+
1. Build PaddlePaddle develop image
183191

184-
.. code-block:: bash
185-
186-
git clone https://github.com/PaddlePaddle/Paddle.git && cd Paddle
187-
188-
Mount both workspace folder and paddle code folder into docker
189-
container, so we can access them inside docker container. There are
190-
two ways of using PaddlePaddle development docker image:
191-
192-
- run interactive bash directly
192+
Use following command to build PaddlePaddle develop image:
193193

194-
.. code-block:: bash
195-
196-
# use nvidia-docker instead of docker if you need to use GPU
197-
docker run -it -v ~/workspace:/workspace -v $(pwd):/paddle paddlepaddle/paddle:0.10.0rc2-dev /bin/bash
198-
# now we are inside docker container
194+
.. code-block:: bash
199195
200-
- or, we can run it as a daemon container
196+
git clone https://github.com/PaddlePaddle/Paddle.git && cd Paddle
197+
docker build -t paddle:dev .
201198
202-
.. code-block:: bash
199+
2. Build PaddlePaddle production image
203200

204-
# use nvidia-docker instead of docker if you need to use GPU
205-
docker run -d -p 2202:22 -p 8888:8888 -v ~/workspace:/workspace -v $(pwd):/paddle paddlepaddle/paddle:0.10.0rc2-dev /usr/sbin/sshd -D
201+
There are two steps for building production image, the first step is to run:
206202

207-
and SSH to this container using password :code:`root`:
208-
209-
.. code-block:: bash
203+
.. code-block:: bash
210204
211-
ssh -p 2202 root@localhost
205+
docker run -v $(pwd):/paddle -e "WITH_GPU=OFF" -e "WITH_AVX=OFF" -e "WITH_TEST=ON" paddle:dev
212206
213-
An advantage is that we can run the PaddlePaddle container on a
214-
remote server and SSH to it from a laptop.
207+
The above command will compile PaddlePaddle and create a Dockerfile for building production image. All the generated files are in the build directory. "WITH_GPU" controls if the generated production image supports GPU. "WITH_AVX" controls if the generated production image supports AVX. "WITH_TEST" controls if the unit test will be generated.
215208

216-
When developing PaddlePaddle, you can edit PaddlePaddle source code
217-
from outside of docker container using your favoriate editor. To
218-
compile PaddlePaddle, run inside container:
209+
The second step is to run:
219210

220-
.. code-block:: bash
211+
.. code-block:: bash
221212
222-
WITH_GPU=OFF WITH_AVX=ON WITH_TEST=ON bash /paddle/paddle/scripts/docker/build.sh
213+
docker build -t paddle:prod -f build/Dockerfile .
223214
224-
This builds everything about Paddle in :code:`/paddle/build`. And we
225-
can run unit tests there:
215+
The above command will generate the production image by copying the compiled PaddlePaddle program into the image.
226216

227-
.. code-block:: bash
217+
3. Run unit test
228218

229-
cd /paddle/build
230-
ctest
219+
Following command will run unit test:
231220

232-
When training model using C++ API, we can edit paddle program in
233-
~/workspace outside of docker. And build from /workspace inside of
234-
docker.
221+
.. code-block:: bash
222+
223+
docker run -it -v $(pwd):/paddle paddle:dev bash -c "cd /paddle/build && ctest"
235224
236225
PaddlePaddle Book
237226
------------------

0 commit comments

Comments
 (0)