如何使用 sed 自动从 docker-compose.yml 中删除 container_name: ... 语句
此脚本将从 docker-compose.yml 配置文件中删除所有 container_name 语句:
remove_container_name_sed.sh
sed -zie 's#container_name:\s*[a-zA-Z0-9_-]*\s*##g' docker-compose.yml示例输入:
docker_compose_example_input.yml
services:
inventree-proxy:
container_name: inventree-proxy
image: nginx:stable
depends_on:
- inventree-server
[...]示例输出:
docker_compose_example_output.yml
services:
inventree-proxy:
image: nginx:stable
depends_on:
- inventree-server
[...]If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow