我正在从 Dockerfile 构建多步映像,但当前一步失败。我想做的是在交互式中运行最后一个成功的步骤并对其进行调试。
不幸的是,Docker 移除了中间容器:
Removing intermediate container dac6772bcf71
---> aa6de00f27db
所以我不能这样做:
docker run -it dac6772bcf71 /bin/bash
我找到了--force-rm
选项,但没有找到keep-intermediate
。
如何告诉 Docker 保留中间容器?
具体例子
IRL,我有这个:
Removing intermediate container dac6772bcf71
---> aa6de00f27db
Step 9/9 : RUN pip install git+https://github.com/heig-vd-tin/sphinx-heigvd-theme.git
---> Running in a4745435a814
Collecting git+https://github.com/heig-vd-tin/sphinx-heigvd-theme.git
Cloning https://github.com/heig-vd-tin/sphinx-heigvd-theme.git to /tmp/pip-req-build-AKf_Kz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-req-build-AKf_Kz/setup.py", line 2, in <module>
import sphinx_heigvd_theme
File "sphinx_heigvd_theme/__init__.py", line 141
toc_href = f'{relative_uri(baseuri, toc_uri)}#{anchor_id}'
所以看来我的 Python < 3.6,但我想检查一下。一种可能性是:
docker run dac6772bcf71 python --version
但我不能,因为父容器被自动销毁了。