Skip to content

Commit 6577782

Browse files
authored
Merge pull request #917 from dayhaha/docker_install
improve docker_install_en.rst
2 parents 023cfda + cea628c commit 6577782

File tree

1 file changed

+87
-77
lines changed

1 file changed

+87
-77
lines changed

doc/getstarted/build_and_install/docker_install_en.rst

Lines changed: 87 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,91 @@ Please be aware that you will need to change `Dockers settings
99
of your hardware resource on Mac OS X and Windows.
1010

1111

12+
Development Using Docker
13+
------------------------
14+
15+
Developers can work on PaddlePaddle using Docker. This allows
16+
developers to work on different platforms -- Linux, Mac OS X, and
17+
Windows -- in a consistent way.
18+
19+
The general development workflow with Docker and Bazel is as follows:
20+
21+
1. Get the source code of Paddle:
22+
23+
.. code-block:: bash
24+
25+
git clone --recursive https://github.com/PaddlePaddle/Paddle.git
26+
27+
28+
Here **git clone --recursive is required** as we have a submodule `warp-ctc <https://github.com/baidu-research/warp-ctc>`_.
29+
30+
If you have used :code:`git clone https://github.com/PaddlePaddle/Paddle` and find that the directory :code:`warp-ctc` is
31+
empty, please use the following command to get the submodule.
32+
33+
.. code-block:: bash
34+
35+
git submodule update --init --recursive
36+
37+
38+
2. Build a development Docker image :code:`paddle:dev` from the source
39+
code. This image contains all the development tools and
40+
dependencies of PaddlePaddle.
41+
42+
43+
.. code-block:: bash
44+
45+
cd paddle
46+
docker build -t paddle:dev -f paddle/scripts/docker/Dockerfile .
47+
48+
49+
3. Run the image as a container and mounting local source code
50+
directory into the container. This allows us to change the code on
51+
the host and build it within the container.
52+
53+
.. code-block:: bash
54+
55+
docker run \
56+
-d \
57+
--name paddle \
58+
-p 2022:22 \
59+
-v $PWD:/paddle \
60+
-v $HOME/.cache/bazel:/root/.cache/bazel \
61+
paddle:dev
62+
63+
where :code:`-d` makes the container running in background,
64+
:code:`--name paddle` allows us to run a nginx container to serve
65+
documents in this container, :code:`-p 2022:22` allows us to SSH
66+
into this container, :code:`-v $PWD:/paddle` shares the source code
67+
on the host with the container, :code:`-v
68+
$HOME/.cache/bazel:/root/.cache/bazel` shares Bazel cache on the
69+
host with the container.
70+
71+
4. SSH into the container:
72+
73+
.. code-block:: bash
74+
75+
ssh root@localhost -p 2022
76+
77+
5. We can edit the source code in the container or on this host. Then
78+
we can build using cmake
79+
80+
.. code-block:: bash
81+
82+
cd /paddle # where paddle source code has been mounted into the container
83+
mkdir -p build
84+
cd build
85+
cmake -DWITH_TESTING=ON ..
86+
make -j `nproc`
87+
CTEST_OUTPUT_ON_FAILURE=1 ctest
88+
89+
or Bazel in the container:
90+
91+
.. code-block:: bash
92+
93+
cd /paddle
94+
bazel test ...
95+
96+
1297
CPU-only and GPU Images
1398
-----------------------
1499

@@ -77,7 +162,7 @@ source code:
77162
.. code-block:: bash
78163
79164
cd ~
80-
git clone github.com/PaddlePaddle/Paddle
165+
git clone https://github.com/PaddlePaddle/Paddle.git
81166
cd Paddle
82167
git submodule update --init --recursive
83168
docker build --build-arg WITH_AVX=OFF -t paddle:cpu-noavx -f paddle/scripts/docker/Dockerfile .
@@ -93,7 +178,7 @@ generated using `woboq code browser
93178
for users to browse and understand the C++ source code.
94179

95180
As long as we give the Paddle Docker container a name, we can run an
96-
additional nginx Docker container to serve the volume from the Paddle
181+
additional Nginx Docker container to serve the volume from the Paddle
97182
container:
98183

99184
.. code-block:: bash
@@ -104,78 +189,3 @@ container:
104189
105190
Then we can direct our Web browser to the HTML version of source code
106191
at http://localhost:8088/paddle/
107-
108-
109-
Development Using Docker
110-
------------------------
111-
112-
Develpers can work on PaddlePaddle using Docker. This allows
113-
developers to work on different platforms -- Linux, Mac OS X, and
114-
Windows -- in a consistent way.
115-
116-
The general development workflow with Docker and Bazel is as follows:
117-
118-
1. Get the source code of Paddle:
119-
120-
.. code-block:: bash
121-
122-
git clone --recursive https://github.com/paddlepaddle/paddle
123-
124-
125-
2. Build a development Docker image :code:`paddle:dev` from the source
126-
code. This image contains all the development tools and
127-
dependencies of PaddlePaddle.
128-
129-
130-
.. code-block:: bash
131-
132-
cd paddle
133-
docker build -t paddle:dev -f paddle/scripts/docker/Dockerfile .
134-
135-
136-
3. Run the image as a container and mounting local source code
137-
directory into the container. This allows us to change the code on
138-
the host and build it within the container.
139-
140-
.. code-block:: bash
141-
142-
docker run \
143-
-d \
144-
--name paddle \
145-
-p 2022:22 \
146-
-v $PWD:/paddle \
147-
-v $HOME/.cache/bazel:/root/.cache/bazel \
148-
paddle:dev
149-
150-
where :code:`-d` makes the container running in background,
151-
:code:`--name paddle` allows us to run a nginx container to serve
152-
documents in this container, :code:`-p 2022:22` allows us to SSH
153-
into this container, :code:`-v $PWD:/paddle` shares the source code
154-
on the host with the container, :code:`-v
155-
$HOME/.cache/bazel:/root/.cache/bazel` shares Bazel cache on the
156-
host with the container.
157-
158-
4. SSH into the container:
159-
160-
.. code-block:: bash
161-
162-
ssh root@localhost -p 2022
163-
164-
5. We can edit the source code in the container or on this host. Then
165-
we can build using cmake
166-
167-
.. code-block:: bash
168-
169-
cd /paddle # where paddle source code has been mounted into the container
170-
mkdir -p build
171-
cd build
172-
cmake -DWITH_TESTING=ON ..
173-
make -j `nproc`
174-
CTEST_OUTPUT_ON_FAILURE=1 ctest
175-
176-
or Bazel in the container:
177-
178-
.. code-block:: bash
179-
180-
cd /paddle
181-
bazel test ...

0 commit comments

Comments
 (0)