Skip to content

Commit

Permalink
feat: docker multi config
Browse files Browse the repository at this point in the history
  • Loading branch information
levy committed Jan 29, 2024
1 parent 81c0db0 commit d71e887
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/devops/docker-build-and-push-script.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ tag:

# Docker 构建镜像、推送、启动实用脚本

## misc
存储多份 docker 认证信息:
```shell
mkdir "~/.project1"
mkdir "~/.project2"

docker --config ~/.project1 login registry.example.com -u <username> -p <deploy_token>
docker --config ~/.project2 login registry.example.com -u <username> -p <deploy_token>
```

使用:
```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
Expand All @@ -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注册表
Expand Down Expand Up @@ -84,7 +101,8 @@ else
fi
```

startup.sh
## startup.sh
`startup.sh`
```shell
#!/bin/sh
# 镜像名称和标签
Expand Down

0 comments on commit d71e887

Please sign in to comment.