Dockerfile实践之centos8安装python3.6.8

# 错误 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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 216,997评论 6 502
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,603评论 3 392
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 163,359评论 0 353
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,309评论 1 292
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,346评论 6 390
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,258评论 1 300
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,122评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,970评论 0 275
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,403评论 1 313
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,596评论 3 334
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,769评论 1 348
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,464评论 5 344
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,075评论 3 327
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,705评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,848评论 1 269
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,831评论 2 370
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,678评论 2 354

推荐阅读更多精彩内容