kolla-ansible 部署openstack train 版本(all-in-one)

零 修订记录

序号 修订内容 修订时间
1 新增 20210402
2 补充添加docker python api 下载方法 20210428
3 补充添加python_openstackclient 下载方法 20210428

一 摘要

本文介绍kolla-ansible 部署openstack train 版本,并把相关资源下载到本地。

二 环境信息

(一)软件信息

2.1.1 操作系统

阿里云虚机

[root@openstack-train ~]# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
[root@openstack-train ~]#

2.1.2 kolla 相关

2.1.3 ansible

2.1.4 docker

2.1.5

三 实施

(零)准备工作

3.0.1 关闭防火墙

[root@openstack-train train]# systemctl stop firewalld && systemctl disable firewalld && systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
[root@openstack-train train]#


3.0.1 关闭selinux

[root@openstack-train sysconfig]# cp selinux selinux.bak.orig
[root@openstack-train sysconfig]# vim selinux
[root@openstack-train sysconfig]# pwd
/etc/sysconfig
[root@openstack-train sysconfig]#

SELINUX=disabled

(一)升级 Python

3.1.1 python 3.6 升级及修改默认python软连接

3.1.1.1 下载python3.6 升级包

[root@openstack-train train]#  yum install --downloadonly --downloaddir=/root/train/python36 python36 python36-devel
Loaded plugins: fastestmirror
Determining fastest mirrors
base                                                                                                                   | 3.6 kB  00:00:00
epel                                                                                                                   | 4.7 kB  00:00:00
extras                                                                                                                 | 2.9 kB  00:00:00
updates                                                                                                                | 2.9 kB  00:00:00
(1/7): epel/x86_64/group_gz                                                                                            |  96 kB  00:00:00
(2/7): base/7/x86_64/group_gz  

3.1.1.2 使用本地离线包安装

有可能报如下错误

[root@openstack-train rpm]#  yum localinstall /root/train/python36/*.rpm

Transaction check error:
  file /etc/rpm/macros.python from install of python-rpm-macros-3-34.el7.noarch conflicts with file from package python-devel-2.7.5-80.el7_6.x86_64

Error Summary
-------------

改用这个命令安装

[root@openstack-train rpm]# rpm -ivh /root/train/python36/*.rpm --replacefiles
Preparing...                          ################################# [100%]
Updating / installing...
   1:python-srpm-macros-3-34.el7      ################################# [  7%]
   2:python-rpm-macros-3-34.el7       ################################# [ 14%]
   3:zip-3.0-11.el7                   ################################# [ 21%]
   4:python3-rpm-macros-3-34.el7      ################################# [ 29%]
   5:perl-srpm-macros-1-8.el7         ################################# [ 36%]
   6:libtirpc-0.2.4-0.16.el7          ################################# [ 43%]
   7:python3-pip-9.0.3-8.el7          ################################# [ 50%]
   8:python3-setuptools-39.2.0-10.el7 ################################# [ 57%]
   9:python3-3.6.8-18.el7             ################################# [ 64%]
  10:python3-libs-3.6.8-18.el7        ################################# [ 71%]
  11:python3-rpm-generators-6-2.el7   ################################# [ 79%]
  12:dwz-0.11-3.el7                   ################################# [ 86%]
  13:redhat-rpm-config-9.1.0-88.el7.ce################################# [ 93%]
  14:python3-devel-3.6.8-18.el7       ################################# [100%]
[root@openstack-train rpm]#

3.1.1.3 python 默认软连接改为python3

[root@openstack-train rpm]# ln -s /usr/bin/python3 /usr/bin/python
ln: failed to create symbolic link ‘/usr/bin/python’: File exists
[root@openstack-train rpm]#  rm /usr/bin/python
rm: remove symbolic link ‘/usr/bin/python’? y
[root@openstack-train rpm]# ln -s /usr/bin/python3 /usr/bin/python
[root@openstack-train rpm]#

3.1.2 pip 升级到最新版及修改默认pip 软连接

3.1.2.1 pip 默认连接改为pip3

[root@openstack-train rpm]# cp /usr/bin/pip /tmp/pip
[root@openstack-train rpm]# rm /usr/bin/pip
rm: remove regular file ‘/usr/bin/pip’? y
[root@openstack-train rpm]#  ln -s /bin/pip3.6 /bin/pip
[root@openstack-train rpm]# pip -V
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
[root@openstack-train rpm]#

3.1.2.2 pip 升级

[root@openstack-train rpm]# pip -V
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
[root@openstack-train rpm]# pip download -i https://pypi.tuna.tsinghua.edu.cn/simple -d /root/train/pythonpip/pipupgrade pip
Collecting pip
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/fe/ef/60d7ba03b5c442309ef42e7d69959f73aacccd0d86008362a681c4698e83/pip-21.0.1-py3-none-any.whl (1.5MB)
    100% |████████████████████████████████| 1.5MB 947kB/s
  Saved /root/train/pythonpip/pipupgrade/pip-21.0.1-py3-none-any.whl
Successfully downloaded pip
[root@openstack-train rpm]#

[root@openstack-train rpm]# pip install --no-index --find-links=/root/train/pythonpip/pipupgrade pip==21.0.1
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip install --user` instead.
Collecting pip==21.0.1
Installing collected packages: pip
Successfully installed pip-21.0.1
[root@openstack-train rpm]# pip -V
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
pip 21.0.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
[root@openstack-train rpm]# python -m pip -V
pip 21.0.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
[root@openstack-train rpm]#

3.1.3 yum 指定到python2.7

3.1.3.1 修改修改/usr/bin/yum文件

[root@openstack-train pipupgrade]# cp /usr/bin/yum /usr/bin/yum.bak.orig
[root@openstack-train pipupgrade]# vim /usr/bin/yum
修改第一行即可

#!/usr/bin/python2.7

3.1.3.2 修改/usr/libexec/urlgrabber-ext-down文件

[root@openstack-train libexec]# cp /usr/libexec/urlgrabber-ext-down /usr/libexec/urlgrabber-ext-down.bak.orig
[root@openstack-train libexec]# vim /usr/libexec/urlgrabber-ext-down
[root@openstack-train libexec]#

修改第一句即可
#! /usr/bin/python2.7

3.1.3.3 验证yum 命令正常使用

[root@openstack-train rpm]# yum install telnet
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package telnet.x86_64 1:0.17-66.el7 will be installed
--> Finished Dependency Resolution

(二) 安装基础依赖

3.2.1 下载基础依赖包

[root@openstack-train rpm]# yum install --downloadonly --downloaddir=/root/train/basedependencies python-devel libffi-devel gcc openssl-devel libselinux-python git yum-utils
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

3.2.2 安装基础依赖包

[root@openstack-train rpm]#  yum localinstall /root/train/basedependencies/*.rpm
Loaded plugins: fastestmirror
Examining /root/train/basedependencies/cpp-4.8.5-44.el7.x86_64.rpm: cpp-4.8.5-44.el7.x86_64

3.2.3 下载python docker api及安装

pip download -i https://pypi.tuna.tsinghua.edu.cn/simple -d /root/train/python2pip/docker docker
pip install --no-index --find-links=/root/train/pythonpip/dockerpython docker==5.0.0 

3.2.4 下载python_openstackclient 及安装

pip download -i https://pypi.tuna.tsinghua.edu.cn/simple -d /root/train/pythonpip/python-openstackclient python-openstackclient
pip install --no-index --find-links=/root/train/pythonpip/python-openstackclient python_openstackclient==5.5.0 

(三)安装docker

3.3.1 配置docker源

[root@openstack-train rpm]# yum-config-manager  --add-repo  https://download.docker.com/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@openstack-train rpm]#

3.3.2 下载docker

[root@openstack-train rpm]# yum install --downloadonly --downloaddir=/root/train/docker  docker-ce
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

3.3.3 docker包安装

[root@openstack-train rpm]# yum localinstall /root/train/docker/*.rpm
Loaded plugins: fastestmirror
Examining /root/train/docker/audit-2.8.5-4.el7.x86_64.rpm: audit-2.8.5-4.el7.x86_64

3.3.4 docker 设置开机启动

[root@openstack-train rpm]# systemctl restart docker && systemctl enable docker && systemctl status docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2021-04-02 20:05:13 CST; 60ms ago
     Docs: https://docs.docker.com
 Main PID: 12106 (dockerd)
   CGroup: /system.slice/docker.service
           └─12106 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

(四)安装ansible(pip 安装)

kolla-ansible 对ansible 版本有要求
Currently, Kolla Ansible requires Ansible 2.6 to 2.9.
用yum 安装 ,ansible 会使用python 2.7,我这里希望用python3.6

3.4.1 下载ansible安装包

[root@openstack-train rpm]# pip download -i https://pypi.tuna.tsinghua.edu.cn/simple -d /root/train/pipku/ansible  ansible==2.9.10
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting ansible==2.9.10
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/03/4f/cccab1ec2e0ecb05120184088e00404b38854809cf35aa76889406fbcbad/ansible-2.9.10.tar.gz (14.2 MB)
     |████████████████████████████████| 14.2 MB 46 kB/s

3.4.2 离线安装

[root@openstack-train rpm]# pip install --no-index --find-links=/root/train/pipku/ansible  ansible==2.9.10
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Looking in links: /root/train/pipku/ansible
Processing /root/train/pipku/ansible/ansible-2.9.10.tar.gz

[root@openstack-train rpm]# ansible --version
ansible 2.9.10
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
[root@openstack-train rpm]#

3.4.3 设置配置文件

pip 安装默认没有配置文件
仿照yum 安装手工添加一个

[root@openstack-train ~]# mkdir -p /etc/ansible/roles
[root@openstack-train ~]# touch /etc/ansible/hosts
[root@openstack-train ~]# vi /etc/ansible/ansible.cfg
[root@openstack-train ~]#

[defaults]
inventory  = $HOME/ansible/hosts
host_key_checking=False
pipelining=True
forks=10

(五)安装kolla

3.5.1 上传下载的kolla

[root@openstack-train kolla]# ll
total 684
drwxr-xr-x 13 root root   4096 Jan 27 04:35 kolla-9.3.1
-rw-r--r--  1 root root 696121 Mar 31 18:19 kolla-9.3.1.zip
[root@openstack-train kolla]# pwd
/root/train/kolla
[root@openstack-train kolla]#

3.5.2 下载依赖包

[root@openstack-train python36]# pip download -i https://pypi.tuna.tsinghua.edu.cn/simple -d /root/train/kolla/kollapip  -r  /root/train/kolla/kolla-9.3.1/requirements.txt
Ignoring GitPython: markers 'python_version < "3.0"' don't match your environment
Collecting pbr!=2.1.0,>=2.0.0 (from -r /root/train/kolla/kolla-9.3.1/requirements.txt (line 4))

3.5.3 安装

git init 这一步不能少,如果是用git clone 下来应该不需要执行该步骤

[root@openstack-train kolla]# cd kolla-9.3.1
[root@openstack-train kolla-9.3.1]# git init
Initialized empty Git repository in /root/train/kolla/kolla-9.3.1/.git/
[root@openstack-train kolla-9.3.1]# pip install /root/train/kolla/kolla-9.3.1 --no-index --find-links=/root/train/kolla/kollapip
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.

安装成功

[root@openstack-train kolla-9.3.1]# kolla-build --version
0.0.0
[root@openstack-train kolla-9.3.1]#

(六)安装kolla-ansible

3.6.1 kolla-ansible 上传到服务器

[root@openstack-train kollaansible]# ll
total 1692
drwxr-xr-x 13 root root    4096 Jan 24 20:20 kolla-ansible-9.3.1
-rw-r--r--  1 root root 1728164 Apr  2 20:22 kolla-ansible-9.3.1.zip
[root@openstack-train kollaansible]# pwd
/root/train/kollaansible
[root@openstack-train kollaansible]#

3.6.2 下载依赖包

[root@openstack-train kollaansible]#  pip download -i https://pypi.tuna.tsinghua.edu.cn/simple -d  /root/train/kollaansible/kollaansiblepip  -r  /root/train/kollaansible/kolla-ansible-9.3.1/requirements.txt
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pbr!=2.1.0,>=2.0.0


3.6.3 用离线包安装


[root@openstack-train kolla-ansible-9.3.1]# git init
Initialized empty Git repository in /root/train/kollaansible/kolla-ansible-9.3.1/.git/
[root@openstack-train kolla-ansible-9.3.1]# python -m pip install /root/train/kollaansible/kolla-ansible-9.3.1 --no-index --find-links=/root/train/kollaansible/kollaansiblepip
Looking in links: /root/train/kollaansible/kollaansiblepip

3.6.4 验证

[root@openstack-train kolla-ansible-9.3.1]# kolla-ansible --version
/usr/local/bin/kolla-ansible: unrecognized option '--version'
Usage: /usr/local/bin/kolla-ansible COMMAND [options]

Options:
    --inventory, -i <inventory_path>   Specify path to ansible inventory file
    --playbook, -p <playbook_path>     Specify path to ansible playbook file
    --configdir <config_path>          Specify path to directory with globals.yml
    --key -k <key_path>                Specify path to ansible vault keyfile

3.6.5 新增kolla-ansilbe 配置文件

[root@openstack-train ~]# mkdir -p /etc/kolla
[root@openstack-train ~]# cp -r /root/train/kollaansible/kolla-ansible-9.3.1/etc/kolla/* /etc/kolla/
[root@openstack-train ~]# ll /etc/kolla/
total 36
-rw-r--r-- 1 root root 24901 Apr  2 20:53 globals.yml
-rw-r--r-- 1 root root  5217 Apr  2 20:53 passwords.yml
[root@openstack-train ~]#

3.6.6 新增anible 配置文件

[root@openstack-train ~]# cp /root/train/kollaansible/kolla-ansible-9.3.1/ansible/inventory/* /root/ansible/
[root@openstack-train ~]# ll /root/ansible/
total 24
-rw-r--r-- 1 root root 9317 Apr  2 20:55 all-in-one
-rw-r--r-- 1 root root 9791 Apr  2 20:55 multinode
[root@openstack-train ~]#

(七)openstack all-in-one 安装

3.7.1 docker 配置

新增 /etc/systemd/system/docker.service.d/kolla.conf

[root@openstack-train system]# cd /etc/systemd/system/
[root@openstack-train system]#  mkdir docker.service.d
[root@openstack-train system]# cd docker.service.d/
[root@openstack-train docker.service.d]# vi kolla.conf
[root@openstack-train docker.service.d]#

[Service]
MountFlags=shared

3.7.2 生成passwords.yml

使用命令生成openstack 部署过程中 使用的密码,然后手工修改下登录密码

[root@openstack-train docker.service.d]# kolla-genpwd
[root@openstack-train docker.service.d]# cd /etc/kolla/
[root@openstack-train kolla]# ll
total 56
-rw-r--r-- 1 root root 24901 Apr  2 20:53 globals.yml
-rw-r--r-- 1 root root 25908 Apr  2 21:05 passwords.yml
[root@openstack-train kolla]#

修改登录密码

/etc/kolla/passwords.yml

keystone_admin_password: Admin_PASS

3.7.3 修改/etc/kolla/globals.yml

[root@openstack-train ansible]# grep -Ev '$|#' /etc/kolla/globals.yml

kolla_base_distro: "centos"
kolla_install_type: "source"
openstack_release: "train"
network_interface: "eth0"
[root@openstack-train ansible]# 

3.7.4 预检查

[root@openstack-train ansible]# kolla-ansible -i /root/ansible/all-in-one prechecks

以上证明kolla kolla-ansible 部署成功,但是用kolla-ansible pull 镜像不全,我改用脚本pull

3.7.5 获取openstack train 版镜像

3.7.5.1 kolla-ansible pull 镜像

nohup kolla-ansible -i /root/ansible/multinode pull &

3.7.5.2 脚本pull 镜像

#!/usr/bin/bash

image_tag=train

# delete images
#docker images | awk '{print $3}' | xargs docker rmi -f

# pull public images
for public_images in memcached kolla-toolbox cron mariadb rabbitmq keepalived haproxy chrony etcd
do
  docker pull kolla/centos-source-$public_images:$image_tag
done

# pull log manage images
for log_images in fluentd elasticsearch kibana
do
  docker pull kolla/centos-source-$log_images:$image_tag
done

# pull nova
for nova in nova-ssh nova-placement-api placement-api nova-api nova-consoleauth nova-serialproxy nova-scheduler nova-novncproxy nova-conductor nova-compute nova-libvirt
do
  docker pull kolla/centos-source-$nova:$image_tag
done

# pull keystone
for keystone in keystone-ssh keystone-fernet keystone
do
  docker pull kolla/centos-source-$keystone:$image_tag
done

# pull glance
docker pull kolla/centos-source-glance-api:$image_tag
docker pull kolla/centos-source-glance-registry:$image_tag

# pull cinder
for cinder in cinder-volume cinder-api cinder-backup cinder-scheduler
do
  docker pull kolla/centos-source-$cinder:$image_tag
done

# pull neutron
for neutron in neutron-server neutron-dhcp-agent neutron-l3-agent neutron-openvswitch-agent neutron-metadata-agent neutron-lbaas-agent neutron-sfc-agent neutron-bgp-dragent
do
  docker pull kolla/centos-source-$neutron:$image_tag
done

# pull openvswitch
docker pull kolla/centos-source-openvswitch-vswitchd:$image_tag
docker pull kolla/centos-source-openvswitch-db-server:$image_tag

# pull horizon
docker pull kolla/centos-source-horizon:$image_tag

# pull heat
for heat in heat-api heat-api-cfn heat-engine
do
  docker pull kolla/centos-source-$heat:$image_tag
done

# pull ceph
for ceph in ceph-mon ceph-osd ceph-mgr cephfs-fuse ceph-rgw ceph-mds
do
  docker pull kolla/centos-source-$ceph:$image_tag
done

# pull zun
for zun in zun-api zun-compute zun-wsproxy
do
  docker pull kolla/centos-source-$zun:$image_tag
done

# pull magnum
for magnum in magnum-api magnum-conductor
do
  docker pull kolla/centos-source-$magnum:$image_tag
done

# pull kuryr
docker pull kolla/centos-source-kuryr-libnetwork:$image_tag

# pull cloudkitty
for cloudkitty in cloudkitty-api cloudkitty-processor
do
  docker pull kolla/centos-source-$cloudkitty:$image_tag
done

# pull grafana influxdb telegraf
for monitor in grafana influxdb telegraf
do
  docker pull kolla/centos-source-$monitor:$image_tag
done

# pull mistral
for mistral in mistral-api mistral-engine mistral-executor mistral-event-engine
do
  docker pull kolla/centos-source-$mistral:$image_tag
done

# pull aodh
for aodh in aodh-api aodh-evaluator aodh-listener aodh-notifier
do
  docker pull kolla/centos-source-$aodh:$image_tag
done

# pull tempest
docker pull kolla/centos-source-tempest:$image_tag

# pull ceilometer
for ceilometer in ceilometer-compute ceilometer-central ceilometer-notification
do
  docker pull kolla/centos-source-$ceilometer:$image_tag
done

# pull gnocchi
for gnocchi in gnocchi-statsd gnocchi-metricd gnocchi-api
do
  docker pull kolla/centos-source-$gnocchi:$image_tag
done

# pull senlin
for senlin in senlin-engine senlin-api
do
  docker pull kolla/centos-source-$senlin:$image_tag
done

# pull manila
for manila in manila-data manila-share manila-scheduler manila-api
do
  docker pull kolla/centos-source-$manila:$image_tag
done

# pull trove
for trove in trove-taskmanager trove-conductor trove-api
do
  docker pull kolla/centos-source-$trove:$image_tag
done

# pull redis
for redis in redis redis-sentinel
do
  docker pull kolla/centos-source-$redis:$image_tag
done

# pull tacker
for tacker in tacker-server tacker-conductor
do
  docker pull kolla/centos-source-$tacker:$image_tag
done

# pull panko-api
docker pull kolla/centos-source-panko-api:$image_tag

# pull kafka
docker pull kolla/centos-source-kafka:$image_tag

# pull zookeeper
docker pull kolla/centos-source-zookeeper:$image_tag

# pull barbican
for barbican in barbican-api barbican-keystone-listener barbican-worker
do
  docker pull kolla/centos-source-$barbican:$image_tag
done

# pull freezer
for freezer in freezer-api freezer-scheduler
do
  docker pull kolla/centos-source-$freezer:$image_tag
done

# pull solum
for solum in solum-api solum-deployer solum-conductor solum-worker
do
  docker pull kolla/centos-source-$solum:$image_tag
done

# pull karbor
for karbor in karbor-api karbor-protection karbor-operationengine
do
  docker pull kolla/centos-source-$karbor:$image_tag
done

# pull searchlight
for searchlight in searchlight-api searchlight-listener
do
  docker pull kolla/centos-source-$searchlight:$image_tag
done

拉取了大约有134个镜像

kolla/centos-source-etcd                                train     e1aa90ec3190   7 days ago     492MB
kolla/centos-source-elasticsearch                       train     5f9d1a2c7246   7 days ago     627MB
kolla/centos-source-multipathd                          train     5f7030dd085e   7 days ago     480MB
kolla/centos-source-kuryr-libnetwork                    train     82017a2599f1   3 months ago   890MB
[root@openstack-train train]# docker images | grep train | wc -l
134
[root@openstack-train train]#

所有镜像save 到本地,准备下载出来。

[root@openstack-train train]# mkdir -p /tmp/images/kolla/
[root@openstack-train train]# for i in ` docker images |grep -v R  |grep train |awk '{print $1}'`;do docker save  $i:train >/tmp/images/$i.tar;done


整理个脚本放到后台运行

#!/bin/bash
for i in ` docker images |grep -v R  |grep train |awk '{print $1}'`;
   do docker save  $i:train >/tmp/images/$i.tar && gzip /tmp/images/$i.tar;
done

 nohup ./savekollaimage.sh &

posted on 2021-04-02 15:54  weiwei2021  阅读(1689)  评论(1编辑  收藏  举报