Skip to content

Commit bd689cb

Browse files
authored
Merge pull request #1578 from gangliao/book
Add Book in Docker
2 parents 5914c5c + b4792a3 commit bd689cb

File tree

5 files changed

+34
-14
lines changed

5 files changed

+34
-14
lines changed

doc/getstarted/build_and_install/docker_install_en.rst

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Windows -- in a consistent way.
4242

4343
.. code-block:: bash
4444
45-
docker run -d -p 2202:22 -v $PWD:/paddle paddle:dev
45+
docker run -d -p 2202:22 -p 8888:8888 -v $PWD:/paddle paddle:dev
4646
4747
This runs a container of the development environment Docker image
4848
with the local source tree mounted to :code:`/paddle` of the
@@ -82,6 +82,29 @@ Windows -- in a consistent way.
8282
cd /paddle/build
8383
ctest
8484
85+
4. Run PaddlePaddle Book under Docker Container
86+
87+
The Jupyter Notebook is an open-source web application that allows
88+
you to create and share documents that contain live code, equations,
89+
visualizations and explanatory text in a single browser.
90+
91+
PaddlePaddle Book is an interactive Jupyter Notebook for users and developers.
92+
We already exposed port 8888 for this book. If you want to
93+
dig deeper into deep learning, PaddlePaddle Book definitely is your best choice.
94+
95+
Once you are inside the container, simply issue the command:
96+
97+
.. code-block:: bash
98+
99+
jupyter notebook
100+
101+
Then, you would back and paste the address into the local browser:
102+
103+
.. code-block:: text
104+
105+
http://localhost:8888/
106+
107+
That's all. Enjoy your journey!
85108

86109
CPU-only and GPU Images
87110
-----------------------

paddle/scripts/docker/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ RUN curl -sSL https://cmake.org/files/v3.4/cmake-3.4.1.tar.gz | tar -xz && \
5050
cd .. && rm -rf cmake-3.4.1
5151

5252
COPY . /paddle/
53+
RUN cd /paddle/ && git submodule update --init --recursive
5354
RUN /paddle/paddle/scripts/docker/build.sh
55+
5456
VOLUME ["/usr/share/nginx/html/data", "/usr/share/nginx/html/paddle"]
5557

5658
# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service
@@ -60,9 +62,7 @@ RUN sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
6062
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
6163
EXPOSE 22
6264

63-
# Jupyter Notebook directory.
64-
RUN mkdir /notes/
65-
WORKDIR "/notes"
65+
# Jupyter Notebook: Paddle book
6666
EXPOSE 8888
6767

6868
COPY ./paddle/scripts/docker/entrypoint /opt/bin/

paddle/scripts/docker/Dockerfile.gpu

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ RUN curl -sSL https://cmake.org/files/v3.4/cmake-3.4.1.tar.gz | tar -xz && \
5050
cd .. && rm -rf cmake-3.4.1
5151

5252
COPY . /paddle/
53+
RUN cd /paddle/ && git submodule update --init --recursive
5354
RUN /paddle/paddle/scripts/docker/build.sh
55+
5456
VOLUME ["/usr/share/nginx/html/data", "/usr/share/nginx/html/paddle"]
5557

5658
# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service
@@ -60,9 +62,7 @@ RUN sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
6062
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
6163
EXPOSE 22
6264

63-
# Jupyter Notebook directory.
64-
RUN mkdir /notes/
65-
WORKDIR "/notes"
65+
# Jupyter Notebook: Paddle book
6666
EXPOSE 8888
6767

6868
COPY ./paddle/scripts/docker/entrypoint /opt/bin/

paddle/scripts/docker/build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ if [[ ${BUILD_AND_INSTALL:-OFF} == 'ON' ]]; then
1717
fi
1818

1919
mkdir -p /paddle/build # -p means no error if exists
20-
cd /paddle/build
20+
# clean local cmake and third_party cache
21+
cd /paddle/build && rm -rf * && rm -rf ../third_party
2122
cmake .. \
2223
-DWITH_DOC=${WITH_DOC:-OFF} \
2324
-DWITH_GPU=${WITH_GPU:-OFF} \

paddle/scripts/docker/entrypoint

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
#!/bin/bash
2-
LOG=/var/log/all
32

4-
touch $LOG
5-
6-
/usr/sbin/sshd -D >> $LOG &
7-
jupyter notebook --ip=0.0.0.0 /notes/ >> $LOG &
8-
tail -f $LOG
3+
/usr/sbin/sshd -D &
4+
jupyter notebook --ip=0.0.0.0 /paddle/book/

0 commit comments

Comments
 (0)