Docker / bin / sh:1 ::找不到miniconda3
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Docker / bin / sh:1 ::找不到miniconda3相关的知识,希望对你有一定的参考价值。
当我尝试使用命令行docker build -t my-image-name .
构建以下Dockerfile时
FROM continuumio/miniconda3
EXPOSE 8880
# Set working directory
WORKDIR /my-workingdir
# Add scripts to docker workdir
ADD Dockerfile .
ADD environment.yml .
ADD all-my-python-files.py .
# Update & installation of linux packages
RUN apt-get update -y &&
apt-get install -y libgl1-mesa-glx apt-utils &&
apt-get install -y openssh-server &&
apt-get install -y net-tools
# Conda update and creation of environment
RUN conda update conda
&& conda env create -f environment.yml
# Activation of environment
&& echo "source activate environment" > ~/.bashrc
# Mount volumes
VOLUME /my-workingdir/Input
CMD ["python" , "execute_given_python_file.py"]
我在构建时遇到错误:/bin/sh: 1: : not found
我在macOS Hihg Sierra版本10.13.6中构建图像但是当我在linux CentOS环境中构建图像时(在另一个Docker容器内),Dockerfile运行完美。我在mac上使用的Docker版本是
- 客户: 版本:18.06.1-这个 API版本:1.38
- 服务器: 发动机: 版本:18.06.1-ce API版本:1.38(最低版本1.12)
我尝试过以下方法:
- 在mac上重新安装Docker
- apt-get update(没有-y)
- sudo apt-get update
- 不要更新
- 不要创建conda环境
- 不要CMD
但我仍然得到错误。如何解决问题?
更新:在构建映像期间出现错误消息之前的最后一行是:
获取:6 http://security.debian.org/debian-security stretch / updates / main amd64软件包[490 kB]获得:7 http://deb.debian.org/debian stretch-updates / main amd64软件包[5476 B]获取:8 http://deb.debian.org/debian stretch / main amd64软件包[9500 kB]获取10.3 MB in 2s(4564 kB / s)读取包列表... / bin / sh:1 ::找不到
Docker返回非零代码:127
为了复制错误,我包括一个python脚本和一个yml环境。
错误期间测试的Python脚本all-my-python-files.py:
# Name of file: all-my-python-files.py
import openpyxl
import requests
import datetime as dt
import time
from pandas.io.json import json_normalize
import argparse
import os
import pandas as pd
print("At this point, libraries should be imported")
print("End of python script")
environment.yml文件是:
name: environment
channels:
- statiskit
- anaconda
- conda-forge
- defaults
dependencies:
- asn1crypto=0.24.0
# For space the following line are not separated into single lines:
- cffi = 1.11.5 - chardet = 3.0.4 - cryptography = 2.3.1 - et_xmlfile = 1.0.1 - idna = 2.7 - jdcal = 1.4 - openpyxl = 2.5.5 - pycparser = 2.18 - pyopenssl = 18.0.0 - pysocks = 1.6.8 - 请求= 2.19.1 - urllib3 = 1.23 - ca-certificates = 2018.8.24 - openssl = 1.0.2p - time = 1.7 - blas = 1.0 - certifi = 2018.8.24 - intel-openmp = 2018.0.3 - libedit = 3.1.20170329 - libffi = 3.2.1# - libgfortran = 3.0.1#未在linux中运行 - mkl = 2018.0.3 - mkl_fft = 1.0.4 - mkl_random = 1.0.1 - ncurses = 6.1 - numpy = 1.15 .1 - numpy-base = 1.15.1 - pandas = 0.23.4 - pip = 10.0.1 - python = 3.7.0 - python-dateutil = 2.7.3 - pytz = 2018.5 - readline = 7.0 - setuptools = 40.2.0 - six = 1.11.0 - sqlite = 3.24.0 - tk = 8.6.8 - wheel = 0.31.1 - xz = 5.2.4 - zlib = 1.2.11# - libcxx = 4.0.1#不在linux中运行# - libcxxabi = 4.0.1#未在linux中运行 - pip: - datetime == 4.2 - zope.interface == 4.5.0前缀:/ Users / Elias / miniconda3 / envs / xlshp
正如@Charler Duffy所提到的,这个问题与脚本中不可见的行尾相关。不知何故,以下列方式编写代码解决了这个问题:
RUN apt-get update
RUN apt-get install -y libgl1-mesa-glx apt-utils openssh-server net-tools
# Conda update and creation of environment
RUN conda update conda &&
conda env create -f environment.yml &&
# Activation of environment and correction of bash
echo "source activate xlshp_env" > ~/.bash
因此,当所有Linux软件包都安装在同一行中时,Dockerfile可以构建映像。
以上是关于Docker / bin / sh:1 ::找不到miniconda3的主要内容,如果未能解决你的问题,请参考以下文章
text sh:__ docker_machine_ps1:找不到命令
Docker-compose:/usr/local/bin/docker-compose:第 1 行:Not:找不到命令