我们正在使用Dockerfile将OCI CLI客户端(v 2.6.8)安装到Docker映像中。
命令是:
curl -L -o /tmp/install.sh https://raw.githubusercontent.com/oracle/oci-cli/2.6.8/scripts/install/install.sh
RUN chmod +x /tmp/install.sh
RUN /tmp/install.sh --accept-all-defaults
奇怪的是,它已经开始工作了一段时间了。
失败,并显示以下错误:
IOError: [Errno 2] No such file or directory: '/root/lib/oracle-cli/bin/bmcs'
在此之前有很长的输出,为简洁起见,我将其截短:
13:11:02 [INFO] Downloading Oracle Cloud Infrastructure CLI install script from https://raw.githubusercontent.com/oracle/oci-cli/v2.5.15/scripts/install/install.py to /tmp/oci_cli_install_tmp_n1q6.
...
13:11:02 [INFO] Python3 not found on system PATH
13:11:02 [INFO] Running install script.
13:11:02 [INFO] python /tmp/oci_cli_install_tmp_n1q6 --accept-all-defaults
13:11:05 [INFO] Already using interpreter /usr/bin/python
13:11:05 [INFO] New python executable in /root/lib/oracle-cli/bin/python.
13:11:05 [INFO] Installing setuptools, pip, wheel...
....
13:11:21 [INFO] Installing collected packages: idna, PyYAML, six, python-dateutil, configparser, enum34, pycparser, cffi, asn1crypto, ipaddress, cryptography, pyOpenSSL, pytz, certifi, oci, arrow, jmespath, terminaltables, click, retrying, oci-cli
13:11:28 [INFO] Successfully installed PyYAML-5.1.2 arrow-0.10.0 asn1crypto-1.2.0 certifi-2019.9.11 cffi-1.13.2 click-6.7 configparser-3.5.0 cryptography-2.4.2 enum34-1.1.6 idna-2.6 ipaddress-1.0.23 jmespath-0.9.3 oci-2.6.5 oci-cli-2.6.13 pyOpenSSL-18.0.0 pycparser-2.19 python-dateutil-2.7.3 pytz-2016.10 retrying-1.3.3 six-1.11.0 terminaltables-3.1.0
13:11:28 [INFO] -- Verifying Python version.
13:11:28 [INFO] -- Python version 2.7.5 okay.
13:11:28 [INFO] -- Creating directory '/root/lib/oracle-cli'.
13:11:28 [INFO] -- We will install at '/root/lib/oracle-cli'.
13:11:28 [INFO] -- Creating directory '/root/bin'.
13:11:28 [INFO] -- The executable will be in '/root/bin'.
13:11:28 [INFO] -- Creating directory '/root/bin/oci-cli-scripts'.
13:11:28 [INFO] -- The scripts will be in '/root/bin/oci-cli-scripts'.
13:11:28 [INFO] -- The optional packages installed will be ''.
13:11:28 [INFO] -- Downloading virtualenv package from https://github.com/pypa/virtualenv/archive/15.0.0.tar.gz.
13:11:28 [INFO] -- Downloaded virtualenv package to /tmp/tmpAuc0vV/15.0.0.tar.gz.
13:11:28 [INFO] -- Checksum of /tmp/tmpAuc0vV/15.0.0.tar.gz OK.
13:11:28 [INFO] -- Extracting '/tmp/tmpAuc0vV/15.0.0.tar.gz' to '/tmp/tmpAuc0vV'.
13:11:28 [INFO] -- Executing: ['/usr/bin/python', 'virtualenv.py', '--python', '/usr/bin/python', '/root/lib/oracle-cli']
13:11:28 [INFO] -- Executing: ['/root/lib/oracle-cli/bin/pip', 'install', '--cache-dir', '/tmp/tmpAuc0vV', 'oci_cli', '--upgrade']
13:11:28 [INFO] Traceback (most recent call last):
13:11:28 [INFO] File "/tmp/oci_cli_install_tmp_n1q6", line 661, in <module>
13:11:28 [INFO] main()
13:11:28 [INFO] File "/tmp/oci_cli_install_tmp_n1q6", line 631, in main
13:11:28 [INFO] shutil.copyfile(os.path.join(install_dir, 'bin', BMCS_EXECUTABLE_NAME), bmcs_exec_path)
13:11:28 [INFO] File "/usr/lib64/python2.7/shutil.py", line 82, in copyfile
13:11:28 [INFO]
13:11:28 [INFO] with open(src, 'rb') as fsrc:
13:11:28 [INFO] IOError: [Errno 2] No such file or directory: '/root/lib/oracle-cli/bin/bmcs'
答案 0 :(得分:0)
尽管安装脚本是特定版本,但它会下拉python wheel的最新版本。
这在日志中如下所示:
13:33:17 [INFO] Collecting oci_cli
13:33:17 [INFO] Downloading https://files.pythonhosted.org/packages/48/fb/eb97ba8f01fda78131513d0126985d6e6c482fac753b80e85a2bb01e3842/oci_cli-2.6.13-py2.py3-none-any.whl (5.8MB)
(安装脚本版本= 2.6.8,已下载python构件版本2.6.13)。
所以停止工作的原因是python轮子以向后不兼容的方式进行了更改。
解决方案是在运行命令中为安装脚本指定版本:
RUN /tmp/install.sh --accept-all-defaults --oci-cli-version 2.6.8