美文网首页
Dockerfile实践之centos8安装python3.6.

Dockerfile实践之centos8安装python3.6.

作者: 不死鸟F21 | 来源:发表于2020-01-31 20:23 被阅读0次
# 错误 Failed to download metadata for repo 'BaseOS'
解决方案: yum install -y nodejs

Dockerfile:(pip设置阿里源)
FROM centos

LABEL version=1.0
LABEL description="base on centos8, install python3.6.8"

ADD pip.conf /root/.pip/

RUN yum install -y nodejs \
&& yum install -y python3 \
&& python3 -m pip install --upgrade pip --user \
&& rm -rf /usr/bin/pip3 \
&& ln -s /root/.local/bin/pip3 /usr/bin/pip3

# pip.confg
[global]
trusted-host=mirrors.aliyun.com
index-url=https://mirrors.aliyun.com/pypi/simple/

[vagrant@localhost centos8_python3.6.8]$ docker build -t xingfeng/centos8_python3.6.8 .
Sending build context to Docker daemon  3.072kB
Step 1/5 : FROM centos
 ---> 470671670cac
Step 2/5 : LABEL version=1.0
 ---> Using cache
 ---> 3f7cf9a78a94
Step 3/5 : LABEL description="base on centos8, install python3.6.8"
 ---> Using cache
 ---> d4f64e161089
Step 4/5 : ADD pip.conf /root/.pip/
 ---> Using cache
 ---> 1e4318a5231d
Step 5/5 : RUN yum install -y nodejs && yum install -y python3 && python3 -m pip install --upgrade pip --user && rm -rf /usr/bin/pip3 && ln -s /usr/local/bin/pip3 /usr/bin/pip3
 ---> Running in 26a655edbacc
CentOS-8 - AppStream                            236 kB/s | 6.0 MB     00:25
CentOS-8 - Base                                 1.5 MB/s | 4.0 MB     00:02
CentOS-8 - Extras                               2.4 kB/s | 2.1 kB     00:00
Dependencies resolved.
================================================================================
 Package
        Arch   Version                                          Repo       Size
================================================================================
Installing:
 nodejs x86_64 1:10.16.3-2.module_el8.0.0+186+542b25fc          AppStream 9.0 M
Installing dependencies:
 npm    x86_64 1:6.9.0-1.10.16.3.2.module_el8.0.0+186+542b25fc  AppStream 3.8 M
Enabling module streams:
 nodejs        10

Transaction Summary
================================================================================
Install  2 Packages

Total download size: 13 M
Installed size: 59 M
Downloading Packages:
(1/2): npm-6.9.0-1.10.16.3.2.module_el8.0.0+186 560 kB/s | 3.8 MB     00:06
(2/2): nodejs-10.16.3-2.module_el8.0.0+186+542b 577 kB/s | 9.0 MB     00:15
--------------------------------------------------------------------------------
Total                                           790 kB/s |  13 MB     00:16
warning: /var/cache/dnf/AppStream-02e86d1c976ab532/packages/nodejs-10.16.3-2.module_el8.0.0+186+542b25fc.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY
CentOS-8 - AppStream                            265 kB/s | 1.6 kB     00:00
Importing GPG key 0x8483C65D:
 Userid     : "CentOS (CentOS Official Signing Key) <security@centos.org>"
 Fingerprint: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Running scriptlet: npm-1:6.9.0-1.10.16.3.2.module_el8.0.0+186+542b25fc.   1/1
  Preparing        :                                                        1/1
  Installing       : npm-1:6.9.0-1.10.16.3.2.module_el8.0.0+186+542b25fc.   1/2
  Installing       : nodejs-1:10.16.3-2.module_el8.0.0+186+542b25fc.x86_6   2/2
  Running scriptlet: nodejs-1:10.16.3-2.module_el8.0.0+186+542b25fc.x86_6   2/2
  Verifying        : nodejs-1:10.16.3-2.module_el8.0.0+186+542b25fc.x86_6   1/2
  Verifying        : npm-1:6.9.0-1.10.16.3.2.module_el8.0.0+186+542b25fc.   2/2

Installed:
  nodejs-1:10.16.3-2.module_el8.0.0+186+542b25fc.x86_64
  npm-1:6.9.0-1.10.16.3.2.module_el8.0.0+186+542b25fc.x86_64

Complete!
Last metadata expiration check: 0:00:27 ago on Fri Jan 31 12:18:07 2020.
Dependencies resolved.
================================================================================
 Package            Arch   Version                              Repo       Size
================================================================================
Installing:
 python36           x86_64 3.6.8-2.module_el8.1.0+245+c39af44f  AppStream  19 k
Installing dependencies:
 python3-pip        noarch 9.0.3-15.el8                         AppStream  19 k
 python3-setuptools noarch 39.2.0-5.el8                         BaseOS    162 k
Enabling module streams:
 python36                  3.6

Transaction Summary
================================================================================
Install  3 Packages

Total download size: 201 k
Installed size: 466 k
Downloading Packages:
(1/3): python3-pip-9.0.3-15.el8.noarch.rpm       94 kB/s |  19 kB     00:00
(2/3): python36-3.6.8-2.module_el8.1.0+245+c39a  82 kB/s |  19 kB     00:00
(3/3): python3-setuptools-39.2.0-5.el8.noarch.r 564 kB/s | 162 kB     00:00
--------------------------------------------------------------------------------
Total                                            58 kB/s | 201 kB     00:03
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Installing       : python3-setuptools-39.2.0-5.el8.noarch                 1/3
  Installing       : python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64    2/3
  Running scriptlet: python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64    2/3
  Installing       : python3-pip-9.0.3-15.el8.noarch                        3/3
  Verifying        : python3-pip-9.0.3-15.el8.noarch                        1/3
  Verifying        : python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64    2/3
  Verifying        : python3-setuptools-39.2.0-5.el8.noarch                 3/3

Installed:
  python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64
  python3-pip-9.0.3-15.el8.noarch
  python3-setuptools-39.2.0-5.el8.noarch

Complete!
WARNING: Running pip install with root privileges is generally not a good idea. Try `__main__.py install --user` instead.
Collecting pip
  Downloading https://mirrors.aliyun.com/pypi/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
Installing collected packages: pip
Successfully installed pip-20.0.2
Removing intermediate container 26a655edbacc
 ---> 31fb0adac1fa
Successfully built 31fb0adac1fa
Successfully tagged xingfeng/centos8_python3.6.8:latest

相关文章

网友评论

      本文标题:Dockerfile实践之centos8安装python3.6.

      本文链接:https://www.haomeiwen.com/subject/yhhnthtx.html