x86下docker镜像中arm64v8/openjdk:8-jre添加vi/vim/ping/curl命令

宿主机X86 docker镜像是arm版本

docker pull  arm64v8/openjdk:8-jre 
#或者
docker pull  arm64v8/openjdk:8

# arm64v8/openjdk:8-jre- 8-jre-slim  这个版本不行,底层还少gnupg gnupg1 gnupg2命令

下载镜像操作步骤问题不大

主要是进去以后啥命令都没,vi都没,咋替换仓库源…在此做笔记

首先通过命令行方式替换

echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse" >/etc/apt/sources.list 
echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse" >>/etc/apt/sources.list 
echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse" >>/etc/apt/sources.list 
echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse" >>/etc/apt/sources.list

这个时候还不能update 因为是https的,然后执行

apt install apt-transport-https 
apt install ca-certificates

不用管WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

这个时候还是不能update 因为会提示

Err:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32
Err:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32
Err:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-backports InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32

然后执行 其中38...32 这串可以替换 其他的不要动

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32

返回内容

Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
Executing: /tmp/apt-key-gpghome.EPhKpYNdpF/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
gpg: key 3B4FE6ACC0B21F32: public key "Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1

再进行apt-get update就可以了
之后再 apt-get install -y vim && apt-get install -y curl 剩下就随意了

令我无语是网上一堆替换仓库源的,都是vi或者vim命令开头,我arm64v8/openjdk这玩意连编辑都没.崩溃,还好找到了文件输入方式

还有就是清华大学开源软件镜像站仓库要分版本的哭死…我是各种换
还有就是阿里arm环境仓库因为版本问题吧各种不好使,也是坑

最后附一个DockerFile

FROM  arm64v8/openjdk:8-jre
MAINTAINER xxx "xxx"
WORKDIR /home/jre

RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse" >/etc/apt/sources.list 
RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse" >>/etc/apt/sources.list 
RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse" >>/etc/apt/sources.list 
RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse" >>/etc/apt/sources.list

RUN apt install apt-transport-https 
RUN apt install ca-certificates
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
RUN apt-get update
RUN apt-get install -y vim
run  apt-get install -y curl
#ENTRYPOINT date

docker build -f /home/jre8/Dockerfile -t jre:8 .
执行结果

Sending build context to Docker daemon  3.072kB
Step 1/13 : FROM  arm64v8/openjdk:8-jre
 ---> 726b45a38636
Step 2/13 : MAINTAINER xxx "xxxx"
 ---> Using cache
 ---> 72f9b95be1bc
Step 3/13 : WORKDIR /home/jre
 ---> Using cache
 ---> c467591dfd4a
Step 4/13 : RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse" >/etc/apt/sources.list
 ---> Using cache
 ---> 162cd24d8f72
Step 5/13 : RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse" >>/etc/apt/sources.list
 ---> Using cache
 ---> 24e9a518ff51
Step 6/13 : RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse" >>/etc/apt/sources.list
 ---> Using cache
 ---> e09a9b9e1265
Step 7/13 : RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse" >>/etc/apt/sources.list
 ---> Using cache
 ---> b4c989697135
Step 8/13 : RUN apt install apt-transport-https
 ---> Using cache
 ---> 1a95b13fd281
Step 9/13 : RUN apt install ca-certificates
 ---> Using cache
 ---> beb31e20ebf6
Step 10/13 : RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
 ---> Using cache
 ---> 013ded7c1ff4
Step 11/13 : RUN apt-get update
 ---> Using cache
 ---> dba1d997d186
Step 12/13 : RUN apt-get install -y vim
 ---> [Warning] The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested
 ---> Running in 43d1dabe430c
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  file libffi6 libgpm2 libmagic-mgc libmagic1 libmpdec2 libncursesw5
  libpython3.6 libpython3.6-minimal libpython3.6-stdlib libreadline7 libtinfo5
  mime-support vim-common vim-runtime xxd
Suggested packages:
  gpm ctags vim-doc vim-scripts
The following NEW packages will be installed:
  file libffi6 libgpm2 libmagic-mgc libmagic1 libmpdec2 libncursesw5
  libpython3.6 libpython3.6-minimal libpython3.6-stdlib libreadline7 libtinfo5
  mime-support vim vim-common vim-runtime xxd
0 upgraded, 17 newly installed, 0 to remove and 2 not upgraded.
Need to get 10.7 MB of archives.
After this operation, 55.9 MB of additional disk space will be used.
Get:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates/main arm64 libtinfo5 arm64 6.1-1ubuntu1.18.04 [71.0 kB]
Get:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates/main arm64 libncursesw5 arm64 6.1-1ubuntu1.18.04 [96.4 kB]
Get:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates/main arm64 libmagic-mgc arm64 1:5.32-2ubuntu0.4 [184 kB]
Get:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates/main arm64 libmagic1 arm64 1:5.32-2ubuntu0.4 [61.9 kB]
Get:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates/main arm64 file arm64 1:5.32-2ubuntu0.4 [21.7 kB]
Get:6 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic/main arm64 libffi6 arm64 3.2.1-8 [17.0 kB]
Get:7 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic/main arm64 libmpdec2 arm64 2.4.2-1ubuntu1 [73.9 kB]
Get:8 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates/main arm64 libpython3.6-minimal arm64 3.6.9-1~18.04ubuntu1.8 [529 kB]
Get:9 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic/main arm64 mime-support all 3.60ubuntu1 [30.1 kB]
Get:10 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic/main arm64 libreadline7 arm64 7.0-3 [107 kB]
Get:11 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates/main arm64 libpython3.6-stdlib arm64 3.6.9-1~18.04ubuntu1.8 [1609 kB]
Get:12 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates/main arm64 xxd arm64 2:8.0.1453-1ubuntu1.9 [49.2 kB]
Get:13 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates/main arm64 vim-common all 2:8.0.1453-1ubuntu1.9 [71.3 kB]
Get:14 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic/main arm64 libgpm2 arm64 1.20.7-5 [14.4 kB]
Get:15 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates/main arm64 libpython3.6 arm64 3.6.9-1~18.04ubuntu1.8 [1307 kB]
Get:16 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates/main arm64 vim-runtime all 2:8.0.1453-1ubuntu1.9 [5436 kB]
Get:17 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates/main arm64 vim arm64 2:8.0.1453-1ubuntu1.9 [982 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 10.7 MB in 6s (1733 kB/s)
Selecting previously unselected package libtinfo5:arm64.
(Reading database ... 7882 files and directories currently installed.)
Preparing to unpack .../00-libtinfo5_6.1-1ubuntu1.18.04_arm64.deb ...
Unpacking libtinfo5:arm64 (6.1-1ubuntu1.18.04) ...
Selecting previously unselected package libncursesw5:arm64.
Preparing to unpack .../01-libncursesw5_6.1-1ubuntu1.18.04_arm64.deb ...
Unpacking libncursesw5:arm64 (6.1-1ubuntu1.18.04) ...
Selecting previously unselected package libmagic-mgc.
Preparing to unpack .../02-libmagic-mgc_1%3a5.32-2ubuntu0.4_arm64.deb ...
Unpacking libmagic-mgc (1:5.32-2ubuntu0.4) ...
Selecting previously unselected package libmagic1:arm64.
Preparing to unpack .../03-libmagic1_1%3a5.32-2ubuntu0.4_arm64.deb ...
Unpacking libmagic1:arm64 (1:5.32-2ubuntu0.4) ...
Selecting previously unselected package file.
Preparing to unpack .../04-file_1%3a5.32-2ubuntu0.4_arm64.deb ...
Unpacking file (1:5.32-2ubuntu0.4) ...
Selecting previously unselected package libffi6:arm64.
Preparing to unpack .../05-libffi6_3.2.1-8_arm64.deb ...
Unpacking libffi6:arm64 (3.2.1-8) ...
Selecting previously unselected package libmpdec2:arm64.
Preparing to unpack .../06-libmpdec2_2.4.2-1ubuntu1_arm64.deb ...
Unpacking libmpdec2:arm64 (2.4.2-1ubuntu1) ...
Selecting previously unselected package libpython3.6-minimal:arm64.
Preparing to unpack .../07-libpython3.6-minimal_3.6.9-1~18.04ubuntu1.8_arm64.deb ...
Unpacking libpython3.6-minimal:arm64 (3.6.9-1~18.04ubuntu1.8) ...
Selecting previously unselected package mime-support.
Preparing to unpack .../08-mime-support_3.60ubuntu1_all.deb ...
Unpacking mime-support (3.60ubuntu1) ...
Selecting previously unselected package libreadline7:arm64.
Preparing to unpack .../09-libreadline7_7.0-3_arm64.deb ...
Unpacking libreadline7:arm64 (7.0-3) ...
Selecting previously unselected package libpython3.6-stdlib:arm64.
Preparing to unpack .../10-libpython3.6-stdlib_3.6.9-1~18.04ubuntu1.8_arm64.deb ...
Unpacking libpython3.6-stdlib:arm64 (3.6.9-1~18.04ubuntu1.8) ...
Selecting previously unselected package xxd.
Preparing to unpack .../11-xxd_2%3a8.0.1453-1ubuntu1.9_arm64.deb ...
Unpacking xxd (2:8.0.1453-1ubuntu1.9) ...
Selecting previously unselected package vim-common.
Preparing to unpack .../12-vim-common_2%3a8.0.1453-1ubuntu1.9_all.deb ...
Unpacking vim-common (2:8.0.1453-1ubuntu1.9) ...
Selecting previously unselected package libgpm2:arm64.
Preparing to unpack .../13-libgpm2_1.20.7-5_arm64.deb ...
Unpacking libgpm2:arm64 (1.20.7-5) ...
Selecting previously unselected package libpython3.6:arm64.
Preparing to unpack .../14-libpython3.6_3.6.9-1~18.04ubuntu1.8_arm64.deb ...
Unpacking libpython3.6:arm64 (3.6.9-1~18.04ubuntu1.8) ...
Selecting previously unselected package vim-runtime.
Preparing to unpack .../15-vim-runtime_2%3a8.0.1453-1ubuntu1.9_all.deb ...
Adding 'diversion of /usr/share/vim/vim80/doc/help.txt to /usr/share/vim/vim80/doc/help.txt.vim-tiny by vim-runtime'
Adding 'diversion of /usr/share/vim/vim80/doc/tags to /usr/share/vim/vim80/doc/tags.vim-tiny by vim-runtime'
Unpacking vim-runtime (2:8.0.1453-1ubuntu1.9) ...
Selecting previously unselected package vim.
Preparing to unpack .../16-vim_2%3a8.0.1453-1ubuntu1.9_arm64.deb ...
Unpacking vim (2:8.0.1453-1ubuntu1.9) ...
Setting up libgpm2:arm64 (1.20.7-5) ...
Setting up mime-support (3.60ubuntu1) ...
Setting up libmagic-mgc (1:5.32-2ubuntu0.4) ...
Setting up libmagic1:arm64 (1:5.32-2ubuntu0.4) ...
Setting up libffi6:arm64 (3.2.1-8) ...
Setting up file (1:5.32-2ubuntu0.4) ...
Setting up xxd (2:8.0.1453-1ubuntu1.9) ...
Setting up vim-common (2:8.0.1453-1ubuntu1.9) ...
Setting up libpython3.6-minimal:arm64 (3.6.9-1~18.04ubuntu1.8) ...
Setting up libmpdec2:arm64 (2.4.2-1ubuntu1) ...
Setting up vim-runtime (2:8.0.1453-1ubuntu1.9) ...
Setting up libtinfo5:arm64 (6.1-1ubuntu1.18.04) ...
Setting up libreadline7:arm64 (7.0-3) ...
Setting up libncursesw5:arm64 (6.1-1ubuntu1.18.04) ...
Setting up libpython3.6-stdlib:arm64 (3.6.9-1~18.04ubuntu1.8) ...
Setting up libpython3.6:arm64 (3.6.9-1~18.04ubuntu1.8) ...
Setting up vim (2:8.0.1453-1ubuntu1.9) ...
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vim (vim) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vimdiff (vimdiff) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rvim (rvim) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rview (rview) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vi (vi) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/view (view) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/ex (ex) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/editor (editor) in auto mode
Processing triggers for libc-bin (2.31-13+deb11u3) ...
Removing intermediate container 43d1dabe430c
 ---> 5f2892b239cc
Step 13/13 : run  apt-get install -y curl
 ---> [Warning] The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested
 ---> Running in c2ddd6d82111
Reading package lists...
Building dependency tree...
Reading state information...
curl is already the newest version (7.74.0-1.3+deb11u2).
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Removing intermediate container c2ddd6d82111
 ---> 1d71df521493
Successfully built 1d71df521493
Successfully tagged jre:8

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值