我正在尝试构建我的Dockerfile,每次尝试添加一个相同的14个步骤。我现在有154个步骤,感到非常沮丧。如何删除这些步骤,并防止它们再次发生?
我正在运行的命令:
sudo docker build - < Dockerfile --tag detect-wpi
docker run --name edgetpu-wpi \
--rm -it --privileged -p 6006:6006 \
--mount type=bind,src=${DETECT_DIR},dst=/tensorflow/models/research/learn \
detect-wpi
我的Dockerfile:
FROM tensorflow/tensorflow:1.12.0-rc2-devel
RUN git clone https://github.com/tensorflow/models.git && \
mv models /tensorflow/models
RUN apt-get update && \
apt-get install -y python python-tk
RUN pip install Cython && \
pip install contextlib2 && \
pip install pillow && \
pip install lxml && \
pip install jupyter && \
pip install matplotlib
# Get protoc 3.0.0, rather than the old version already in the container
RUN curl -OL "https://github.com/google/protobuf/releases/download/v3.0.0/protoc-3.0.0-linux-x86_64.zip" && \
unzip protoc-3.0.0-linux-x86_64.zip -d proto3 && \
mv proto3/bin/* /usr/local/bin && \
mv proto3/include/* /usr/local/include && \
rm -rf proto3 protoc-3.0.0-linux-x86_64.zip
# Install pycocoapi
RUN git clone --depth 1 https://github.com/cocodataset/cocoapi.git && \
cd cocoapi/PythonAPI && \
make -j8 && \
cp -r pycocotools /tensorflow/models/research && \
cd ../../ && \
rm -rf cocoapi
# Run protoc on the object detection repo
RUN cd /tensorflow/models/research && \
protoc object_detection/protos/*.proto --python_out=.
# Set the PYTHONPATH to finish installing the API
ENV PYTHONPATH $PYTHONPATH:/tensorflow/models/research:/tensorflow/models/research/slim
# Install wget (to make life easier below) and editors (to allow people to edit
# the files inside the container)
RUN apt-get update && \
apt-get install -y wget vim emacs nano
ARG work_dir=/tensorflow/models/research
# Get object detection transfer learning scripts.
ARG scripts_link="http://storage.googleapis.com/cloud-iot-edge-pretrained-models/docker/obj_det_scripts.tgz"
RUN cd ${work_dir} && \
wget -O obj_det_scripts.tgz ${scripts_link} && \
tar zxvf obj_det_scripts.tgz
RUN cd /tensorflow/models/research && \
git clone NEW_LINK && \
cd FRCCoralTFLite && \
cp setup.sh ../setup.sh
WORKDIR ${work_dir}
答案 0 :(得分:0)
我的问题已通过清除docker缓存解决。
docker system prune