Skip to content

Commit 001b426

Browse files
authored
Merge pull request #1642 from typhoonzero/dockerreadme
Update docker build instructions
2 parents 96f42d8 + 8f79efc commit 001b426

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

paddle/scripts/docker/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,18 @@ docker build -t paddle:dev .
8383

8484
The `docker build` command assumes that `Dockerfile` is in the root source tree. Note that in this design, this `Dockerfile` is this only one in our repo.
8585

86+
Users can specify a Ubuntu mirror server for faster downloading:
87+
88+
```bash
89+
docker build -t paddle:dev --build-arg UBUNTU_MIRROR=mirror://mirrors.ubuntu.com/mirrors.txt .
90+
```
8691

8792
### Build PaddlePaddle from Source Code
8893

8994
Given the development image `paddle:dev`, the following command builds PaddlePaddle from the source tree on the development computer (host):
9095

9196
```bash
92-
docker run -v $PWD:/paddle -e "GPU=OFF" -e "AVX=ON" -e "TEST=ON" paddle:dev
97+
docker run -v $PWD:/paddle -e "WITH_GPU=OFF" -e "WITH_AVX=ON" -e "TEST=OFF" paddle:dev
9398
```
9499

95100
This command mounts the source directory on the host into `/paddle` in the container, so the default entry point of `paddle:dev`, `build.sh`, could build the source code with possible local changes. When it writes to `/paddle/build` in the container, it writes to `$PWD/build` on the host indeed.
@@ -100,6 +105,10 @@ This command mounts the source directory on the host into `/paddle` in the conta
100105
- `$PWD/build/paddle-<version>.deb` for production installation, and
101106
- `$PWD/build/Dockerfile`, which builds the production Docker image.
102107

108+
Users can specify the following Docker build arguments with either "ON" or "OFF" value:
109+
- `WITH_GPU`: ***Required***. Generates NVIDIA CUDA GPU code and relies on CUDA libraries.
110+
- `WITH_AVX`: ***Required***. Set to "OFF" prevents from generating AVX instructions. If you don't know what is AVX, you might want to set "ON".
111+
- `TEST`: ***Optional, default OFF***. Build unit tests and run them after building.
103112

104113
### Build the Production Docker Image
105114

paddle/scripts/docker/build.sh

100755100644
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,9 @@ fi
8080
cat > /paddle/build/Dockerfile <<EOF
8181
FROM ${BASE_IMAGE}
8282
MAINTAINER PaddlePaddle Authors <[email protected]>
83-
8483
ENV HOME /root
8584
ENV LANG en_US.UTF-8
86-
8785
# Use Fix locales to en_US.UTF-8
88-
8986
RUN ${MIRROR_UPDATE}
9087
apt-get update && \
9188
apt-get install -y libgfortran3 libpython2.7 ${GPU_DOCKER_PKG} && \
@@ -94,10 +91,8 @@ RUN ${MIRROR_UPDATE}
9491
pip install -U 'protobuf==3.1.0' requests numpy
9592
# Use different deb file when building different type of images
9693
ADD build/*.deb /usr/local/opt/paddle/deb/
97-
9894
# run paddle version to install python packages first
9995
RUN dpkg -i /usr/local/opt/paddle/deb/*.deb && rm -f /usr/local/opt/paddle/deb/*.deb && paddle version
100-
10196
${DOCKERFILE_GPU_ENV}
10297
# default command shows the paddle version and exit
10398
CMD ["paddle", "version"]

0 commit comments

Comments
 (0)