自动生成runc的config.json文件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了自动生成runc的config.json文件相关的知识,希望对你有一定的参考价值。

参考技术A

有时候编写runc的config.json确实是蛋疼的一件事,后来发现可以直接生成,睿智了。

拿postgresql举例子吧,首先先用docker运行它的镜像。
docker run -d postgres:10.7-alpine

然后去/run/docker下面去查找config.json

5f07822f92ebf2c485a6dfac8771d这一串东西就是上面那个容器的id。

之后可以把镜像打包成tgz
docker export $(docker create postgres:10.7-alpine) | tar -C rootfs -xvf -
然后把rootfs下的所有东西直接打包
tar -czf postgres.tar.gz rootfs

!!!如果不打包rootfs这个文件夹的话,而是打包里面的文件,有时会出现runc运行容器提示里面的命令权限不足的问题,这是个很蛋疼的问题,很不好察觉

如果要在其他地方运行这个容器的话,需要改一改config.json里面的一些配置信息,比如里面的

path需要改成/you-path/rootfs

也可以在mounts下加上挂载,

自 .dart_tool/package_config.json 文件生成后 pubspec.lock 文件已更改,请再次运行“pub get”

【中文标题】自 .dart_tool/package_config.json 文件生成后 pubspec.lock 文件已更改,请再次运行“pub get”【英文标题】:The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "pub get" again 【发布时间】:2021-05-06 05:57:52 【问题描述】:

我尝试使用自定义预测试脚本在 codemagic 上运行测试。这是我的预测试脚本:

#!/bin/sh
cd libraries
cd dependencies
flutter pub get
cd ..
cd core
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
cd ..
cd ..
cd features
cd splash
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
cd ..
cd proposal
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs

这是我的颤振项目结构:

但是当pre-test 运行时,我得到这个错误:

Running "flutter pub get" in dependencies...                        2.5s
Running "flutter pub get" in core...                                4.9s
The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "pub get" again.
pub finished with exit code 65
Running "flutter pub get" in splash...                              3.0s
The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "pub get" again.
pub finished with exit code 65
Running "flutter pub get" in proposal...                            3.2s
The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "pub get" again.
pub finished with exit code 65


Build failed :|
Step 4 script `Pre-test script` exited with status code 65

我认为这个错误是因为flutter pub run build_runner build --delete-conflicting-outputs 当我想通过codemagic 生成.g.dart 文件时。

我尝试谷歌但仍未找到解决方案,有人可以帮我解决codemagic上的这个错误吗?

【问题讨论】:

与您的问题无关,但您可以使用单行 cd 命令 cd libraries/dependenciescd ../core 保持脚本清洁 【参考方案1】:

我修复了两次添加flutter pub run

#!/bin/sh
cd libraries
cd dependencies
flutter pub get
cd ..
cd core
flutter pub get
flutter pub get // add again
flutter pub run build_runner build --delete-conflicting-outputs
cd ..
cd ..
cd features
cd splash
flutter pub get
flutter pub get // add again
flutter pub run build_runner build --delete-conflicting-outputs
cd ..
cd proposal
flutter pub get
flutter pub get // add again
flutter pub run build_runner build --delete-conflicting-outputs

【讨论】:

以上是关于自动生成runc的config.json文件的主要内容,如果未能解决你的问题,请参考以下文章

微信小游戏 项目配置文件 project.config.json

网站地图sitemap.xml自动更新lastmod文件(PHP代码)-更新

vue请求本地json文件,config.json配置动态地址,维护无需修改代码

Hibernate自动生的SQL语句错误

鸿蒙应用配置文件简介

UI Recorder 自动化测试 配置项