Anaconda3 Docker: /bin/bash: 没有那个文件或目录

Anaconda3 Docker: /bin/bash: no such file or directory

我正在尝试将 official docker image 用于 anaconda3。在 dockerhub 上,它给出了一个关于 运行 jupyter notebook 的例子:

 docker run -i --rm -t -p 8888:8888 continuumio/anaconda3 /bin/bash -c "/opt/conda/bin/conda install jupyter -y --quiet && mkdir /opt/notebooks && /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser"

但它退出并显示消息

docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown.

此外,我无法使用 bashapt-get 和其他各种命令行工具。为什么?

Continuum 最近决定将他们的基础映像从 debian 切换到 alpine linux(参见 this issue on GitHub)。因此,需要更换一些命令行工具:

  • bash -> sh
  • apt-get -> apk

您可以像这样使用 docker anaconda3 启动一个 jupyter notebook:

docker run -i --rm -t -p 8888:8888 continuumio/anaconda3 /bin/sh -c "/opt/conda/bin/conda install jupyter -y --quiet && mkdir /opt/notebooks && /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip='0.0.0.0' --port=8888 --no-browser"

...并访问 http://localhost:8888/