Skip to content

Commit aeeb116

Browse files
Elizaaaaachuyang-deng
authored andcommitted
fix: formatting dockerfiles for 2.0.0 (#251)
* formatting unpinned awscli version pinned numpy to a higher version * correct format * more format add sagemaker-tensorflow>=2.0, <2.1
1 parent 95b1cba commit aeeb116

File tree

4 files changed

+359
-329
lines changed

4 files changed

+359
-329
lines changed

docker/2.0.0/py2/Dockerfile.cpu

Lines changed: 72 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@ LABEL maintainer="Amazon AI"
55
# prevent stopping by user interaction
66
ENV DEBIAN_FRONTEND noninteractive
77
ENV DEBCONF_NONINTERACTIVE_SEEN true
8+
ENV SAGEMAKER_TRAINING_MODULE sagemaker_tensorflow_container.training:main
9+
10+
# Set environment variables for MKL
11+
# For more about MKL with TensorFlow see:
12+
# https://www.tensorflow.org/performance/performance_guide#tensorflow_with_intel%C2%AE_mkl_dnn
13+
ENV KMP_AFFINITY=granularity=fine,compact,1,0
14+
ENV KMP_BLOCKTIME=1
15+
ENV KMP_SETTINGS=0
16+
17+
ENV PYTHONDONTWRITEBYTECODE=1
18+
ENV PYTHONUNBUFFERED=1
19+
ENV PYTHONIOENCODING=UTF-8
20+
ENV LANG=C.UTF-8
21+
ENV LC_ALL=C.UTF-8
22+
23+
ARG FRAMEWORK_SUPPORT_INSTALLABLE=sagemaker_tensorflow_container-2.0.8.dev0.tar.gz
24+
ARG TENSORFLOW_WHL=tensorflow-2.0.0-cp27-cp27mu-manylinux2010_x86_64.whl
25+
26+
ARG PYTHON=python
27+
ARG PYTHON_PIP=python-pip
28+
ARG PIP=pip
829

930
RUN apt-get update && apt-get install -y --no-install-recommends \
1031
software-properties-common \
@@ -17,93 +38,82 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1738
wget \
1839
vim \
1940
zlib1g-dev \
20-
&& rm -rf /var/lib/apt/lists/*
41+
&& rm -rf /var/lib/apt/lists/*
2142

2243
# Install Open MPI
23-
RUN mkdir /tmp/openmpi && \
24-
cd /tmp/openmpi && \
25-
curl -fSsL -O https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.1.tar.gz && \
26-
tar zxf openmpi-4.0.1.tar.gz && \
27-
cd openmpi-4.0.1 && \
28-
./configure --enable-orterun-prefix-by-default && \
29-
make -j $(nproc) all && \
30-
make install && \
31-
ldconfig && \
32-
rm -rf /tmp/openmpi
44+
RUN mkdir /tmp/openmpi \
45+
&& cd /tmp/openmpi \
46+
&& curl -fSsL -O https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.1.tar.gz \
47+
&& tar zxf openmpi-4.0.1.tar.gz \
48+
&& cd openmpi-4.0.1 \
49+
&& ./configure --enable-orterun-prefix-by-default \
50+
&& make -j $(nproc) all \
51+
&& make install \
52+
&& ldconfig \
53+
&& rm -rf /tmp/openmpi
3354

3455
# Create a wrapper for OpenMPI to allow running as root by default
35-
RUN mv /usr/local/bin/mpirun /usr/local/bin/mpirun.real && \
36-
echo '#!/bin/bash' > /usr/local/bin/mpirun && \
37-
echo 'mpirun.real --allow-run-as-root "$@"' >> /usr/local/bin/mpirun && \
38-
chmod a+x /usr/local/bin/mpirun
56+
RUN mv /usr/local/bin/mpirun /usr/local/bin/mpirun.real \
57+
&& echo '#!/bin/bash' > /usr/local/bin/mpirun \
58+
&& echo 'mpirun.real --allow-run-as-root "$@"' >> /usr/local/bin/mpirun \
59+
&& chmod a+x /usr/local/bin/mpirun
3960

40-
RUN echo "hwloc_base_binding_policy = none" >> /usr/local/etc/openmpi-mca-params.conf && \
41-
echo "rmaps_base_mapping_policy = slot" >> /usr/local/etc/openmpi-mca-params.conf
61+
RUN echo "hwloc_base_binding_policy = none" >> /usr/local/etc/openmpi-mca-params.conf \
62+
&& echo "rmaps_base_mapping_policy = slot" >> /usr/local/etc/openmpi-mca-params.conf
4263

4364
ENV LD_LIBRARY_PATH=/usr/local/openmpi/lib:$LD_LIBRARY_PATH
44-
4565
ENV PATH /usr/local/openmpi/bin/:$PATH
4666

4767
# SSH login fix. Otherwise user is kicked off after login
4868
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
4969

5070
# Create SSH key.
51-
RUN mkdir -p /root/.ssh/ && \
52-
mkdir -p /var/run/sshd && \
53-
ssh-keygen -q -t rsa -N '' -f /root/.ssh/id_rsa && \
54-
cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys && \
55-
printf "Host *\n StrictHostKeyChecking no\n" >> /root/.ssh/config
56-
57-
# Set environment variables for MKL
58-
# For more about MKL with TensorFlow see:
59-
# https://www.tensorflow.org/performance/performance_guide#tensorflow_with_intel%C2%AE_mkl_dnn
60-
ENV KMP_AFFINITY=granularity=fine,compact,1,0 KMP_BLOCKTIME=1 KMP_SETTINGS=0
71+
RUN mkdir -p /root/.ssh/ \
72+
&& mkdir -p /var/run/sshd \
73+
&& ssh-keygen -q -t rsa -N '' -f /root/.ssh/id_rsa \
74+
&& cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys \
75+
&& printf "Host *\n StrictHostKeyChecking no\n" >> /root/.ssh/config
6176

6277
WORKDIR /
6378

64-
ARG PYTHON=python
65-
ARG PYTHON_PIP=python-pip
66-
ARG PIP=pip
67-
6879
RUN apt-get update && apt-get install -y \
6980
${PYTHON} \
7081
${PYTHON_PIP}
7182

72-
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PYTHONIOENCODING=UTF-8 LANG=C.UTF-8 LC_ALL=C.UTF-8
73-
74-
ARG framework_support_installable=sagemaker_tensorflow_container-2.0.8.dev0.tar.gz
75-
ARG sagemaker_tensorflow_extensions=tensorflow-2.0.0-cp27-cp27mu-manylinux2010_x86_64.whl
76-
COPY $framework_support_installable .
77-
COPY $sagemaker_tensorflow_extensions .
83+
COPY $FRAMEWORK_SUPPORT_INSTALLABLE .
84+
COPY $TENSORFLOW_WHL .
7885

79-
RUN ${PIP} --no-cache-dir install --upgrade pip setuptools
86+
RUN ${PIP} --no-cache-dir install --upgrade \
87+
pip \
88+
setuptools
8089

8190
# Some TF tools expect a "python" binary
8291
RUN ln -s $(which ${PYTHON}) /usr/local/bin/python
8392

8493
RUN ${PIP} install --no-cache-dir -U \
85-
numpy==1.16.4 \
86-
scipy==1.2.2 \
87-
scikit-learn==0.20.3 \
88-
pandas==0.24.2 \
89-
Pillow==6.1.0 \
90-
h5py==2.9.0 \
91-
keras_applications==1.0.8 \
92-
keras_preprocessing==1.1.0 \
93-
requests==2.22.0 \
94-
keras==2.2.4 \
95-
awscli==1.16.196 \
96-
mpi4py==3.0.2 \
97-
$sagemaker_tensorflow_extensions \
98-
# Let's install TensorFlow separately in the end to avoid
99-
# the library version to be overwritten
100-
# && ${PIP} install --force-reinstall --no-cache-dir -U ${TF_URL} \
101-
&& ${PIP} install --no-cache-dir -U $framework_support_installable && \
102-
rm -f $framework_support_installable \
103-
&& ${PIP} install --no-cache-dir -U horovod==0.18.2 \
104-
&& ${PIP} uninstall -y --no-cache-dir \
105-
markdown
106-
107-
ENV SAGEMAKER_TRAINING_MODULE sagemaker_tensorflow_container.training:main
94+
numpy==1.16.5 \
95+
scipy==1.2.2 \
96+
scikit-learn==0.20.3 \
97+
pandas==0.24.2 \
98+
Pillow==6.1.0 \
99+
h5py==2.9.0 \
100+
keras_applications==1.0.8 \
101+
keras_preprocessing==1.1.0 \
102+
requests==2.22.0 \
103+
keras==2.3.1 \
104+
awscli \
105+
mpi4py==3.0.2 \
106+
# Let's install TensorFlow separately in the end to avoid
107+
# the library version to be overwritten
108+
# ${PIP} install --force-reinstall --no-cache-dir -U ${TF_URL} \
109+
&& ${PIP} install --force-reinstall --no-cache-dir -U \
110+
$TENSORFLOW_WHL \
111+
&& ${PIP} install --no-cache-dir -U \
112+
$FRAMEWORK_SUPPORT_INSTALLABLE \
113+
&& rm -f $FRAMEWORK_SUPPORT_INSTALLABLE \
114+
&& ${PIP} install --no-cache-dir -U \
115+
horovod==0.18.2 \
116+
&& ${PIP} uninstall -y --no-cache-dir \
117+
markdown
108118

109119
CMD ["bin/bash"]

0 commit comments

Comments
 (0)