Skip to content

Commit

Permalink
Support Docker credential helpers (#1075)
Browse files Browse the repository at this point in the history
* support docker credential and add docker-credential-ecr-login into alpine image

* Remove ecr from docker and add docs

* Update docs/docs/30-administration/22-backends/10-docker.md

Co-authored-by: WeStone <xuecanlong@qq.com>
Co-authored-by: Anbraten <anton@ju60.de>
  • Loading branch information
3 people authored Aug 14, 2022
1 parent b7957c5 commit bed3ef1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/docs/30-administration/22-backends/10-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ Set to the name of an existing network which will be attached to all your pipeli
Enable IPv6 for the networks used by pipeline containers (steps). Make sure you configured your docker daemon to support IPv6.

## Docker credentials

Woodpecker supports [Docker credentials](https://github.com/docker/docker-credential-helpers) to securely store registry credentials. Install your corresponding credential helper and configure it in your Docker config file passed via [`WOODPECKER_DOCKER_CONFIG`](/docs/administration/server-config#woodpecker_docker_config).

To add your credential helper to the Woodpecker server container you could use the following code to build a custom image:

```dockerfile
FROM woodpeckerci/woodpecker-server:latest-alpine

RUN apk add -U --no-cache docker-credential-ecr-login
```

## Podman support

While the agent was developped with Docker/Moby, Podman can also be used by setting the environment variable `DOCKER_SOCK` to point to the podman socket. In order to work without workarounds, Podman 4.0 (or above) is required.
7 changes: 7 additions & 0 deletions server/plugins/registry/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ func parseDockerConfig(path string) ([]*model.Registry, error) {
return nil, err
}

for registryHostname := range configFile.CredentialHelpers {
newAuth, err := configFile.GetAuthConfig(registryHostname)
if err == nil {
configFile.AuthConfigs[registryHostname] = newAuth
}
}

for addr, ac := range configFile.AuthConfigs {
if ac.Auth != "" {
ac.Username, ac.Password, err = decodeAuth(ac.Auth)
Expand Down

0 comments on commit bed3ef1

Please sign in to comment.