Skip to content

Commit c043d71

Browse files
committed
Add Book in Docker
1 parent 00cce87 commit c043d71

File tree

5 files changed

+33
-9
lines changed

5 files changed

+33
-9
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
@@ -34,6 +34,8 @@ RUN apt-get update && \
3434

3535
# git credential to skip password typing
3636
RUN git config --global credential.helper store
37+
# fetch PaddlePaddle book
38+
RUN git submodule update --init --recursive
3739

3840
# Fix locales to en_US.UTF-8
3941
RUN localedef -i en_US -f UTF-8 en_US.UTF-8
@@ -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
@@ -34,6 +34,8 @@ RUN apt-get update && \
3434

3535
# git credential to skip password typing
3636
RUN git config --global credential.helper store
37+
# fetch PaddlePaddle book
38+
RUN git submodule update --init --recursive
3739

3840
# Fix locales to en_US.UTF-8
3941
RUN localedef -i en_US -f UTF-8 en_US.UTF-8
@@ -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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ LOG=/var/log/all
44
touch $LOG
55

66
/usr/sbin/sshd -D >> $LOG &
7-
jupyter notebook --ip=0.0.0.0 /notes/ >> $LOG &
7+
jupyter notebook --ip=0.0.0.0 /paddle/book/ >> $LOG &
88
tail -f $LOG

0 commit comments

Comments
 (0)