美文网首页
Jenkins集群在公司内部的实践(二)

Jenkins集群在公司内部的实践(二)

作者: 天草二十六_简村人 | 来源:发表于2021-07-27 20:49 被阅读0次

本文主要记述docker镜像在私有仓库harbor的使用。

1. 拉取docker hub的镜像

docker pull yarnpkg/node-yarn

2.进入容器

docker images

找到拉下来的镜像,运行进入容器
sudo docker run -it yarnpkg/node-yarn:latest /bin/bash

3.给镜像打tag

sudo docker tag 73bcdd868994 harbor.xx.cloud/library/xx-nodejs-yarn:13.0.1

4.登录harbor

> docker login -u admin -p 123456 harbor.xx.cloud
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

5.推送镜像

sudo docker push harbor.xx.cloud/library/xx-nodejs-yarn:13.0.1

6.制作新镜像

6.1 启动容器

sudo docker run -it harbor.xx.cloud/library/xx-nodejs-yarn:13  /bin/bash

安装需要的软件
比如:ubuntu下安装zip命令

apt-get install zip unzip

//如果安装失败,则执行更新命令:

apt-get update

6.2 docker ps 找到容器ID

CONTAINER ID   IMAGE                                       COMMAND                  CREATED          STATUS          PORTS                                                                                                                                  NAMES
c4ab359cb043   harbor.xx.cloud/library/xx-nodejs-yarn:13   "docker-entrypoint.s…"   16 minutes ago   Up 16 minutes                                                                                                                                          wizardly_herschel           

注意:下面是容器ID, 不是镜像ID。

6.3 将容器打包为新镜像

docker commit c4ab359cb043 harbor.xx.cloud/library/xx-nodejs-yarn:13.0.1

6.4 检验zip命令是否安装成功

sudo docker run -it harbor.xx.cloud/library/xx-nodejs-yarn:13.0.1  /bin/bash

root@f5317a39252a:/home/node/nemv# zip
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
Zip 3.0 (July 5th 2008). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
  The default action is to add or replace zipfile entries from list, which
  can include the special name - to compress standard input.
  If zipfile and list are omitted, zip compresses stdin to stdout.
  -f   freshen: only changed files  -u   update: only changed or new files
  -d   delete entries in zipfile    -m   move into zipfile (delete OS files)
  -r   recurse into directories     -j   junk (don't record) directory names
  -0   store only                   -l   convert LF to CR LF (-ll CR LF to LF)
  -1   compress faster              -9   compress better
  -q   quiet operation              -v   verbose operation/print version info
  -c   add one-line comments        -z   add zipfile comment
  -@   read names from stdin        -o   make zipfile as old as latest entry
  -x   exclude the following names  -i   include only the following names
  -F   fix zipfile (-FF try harder) -D   do not add directory entries
  -A   adjust self-extracting exe   -J   junk zipfile prefix (unzipsfx)
  -T   test zipfile integrity       -X   eXclude eXtra file attributes
  -y   store symbolic links as the link instead of the referenced file
  -e   encrypt                      -n   don't compress these suffixes
  -h2  show more help
  
root@f5317a39252a:/home/node/nemv# exit
exit

7.推送上面制作好的镜像

sudo docker push harbor.xx.cloud/library/xx-nodejs-yarn:13.0.1

相关文章

网友评论

      本文标题:Jenkins集群在公司内部的实践(二)

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