From d71e8876b76d62fd73544152a26152e340ea4f23 Mon Sep 17 00:00:00 2001 From: levy Date: Mon, 29 Jan 2024 15:08:26 +0800 Subject: [PATCH] feat: docker multi config --- src/devops/docker-build-and-push-script.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/devops/docker-build-and-push-script.md b/src/devops/docker-build-and-push-script.md index 90b0a958..10674555 100644 --- a/src/devops/docker-build-and-push-script.md +++ b/src/devops/docker-build-and-push-script.md @@ -7,6 +7,23 @@ tag: # Docker 构建镜像、推送、启动实用脚本 +## misc +存储多份 docker 认证信息: +```shell +mkdir "~/.project1" +mkdir "~/.project2" + +docker --config ~/.project1 login registry.example.com -u -p +docker --config ~/.project2 login registry.example.com -u -p +``` + +使用: +```shell +docker --config ~/.project1 pull registry.example.com/project1 +docker --config ~/.project2 pull registry.example.com/project2 +``` + +## build-image.sh support command: ```shell # only build @@ -15,7 +32,7 @@ support command: ./build-image.sh -u xxx -p xxx --push ``` -build-image.sh (remember to replace `xxx` with true value): +`build-image.sh` (remember to replace `xxx` with true value): ```shell #!/bin/sh # Docker注册表 @@ -84,7 +101,8 @@ else fi ``` -startup.sh +## startup.sh +`startup.sh` ```shell #!/bin/sh # 镜像名称和标签