2021-04-09 12:57:09 +05:30
# podman-login
2021-04-01 14:08:52 +05:30
[](https://github.com/redhat-actions/podman-login/actions?query=workflow%3A%22CI+checks%22)
[](https://github.com/redhat-actions/podman-login/actions?query=workflow%3ABuild)
[](https://github.com/redhat-actions/podman-login/actions?query=workflow%3A%22Link+checker%22)
< br >
< br >
[](https://github.com/redhat-actions/podman-login/tags)
[](./LICENSE)
[](./dist)
2021-04-07 12:55:36 -04:00
Podman Login is a GitHub Action to log in to a container image registry.
2021-04-01 14:08:52 +05:30
2021-04-07 12:55:36 -04:00
After logging in, you can work with the registry as an authenticated user, performing actions such as pushing an image, or pulling a private image. On GitHub runners, the authentication will be deleted at the end of each job as the workspace is cleaned up.
2021-04-09 12:57:09 +05:30
Also see ** [push-to-registry ](https://github.com/redhat-actions/push-to-registry )** and ** [buildah-build ](https://github.com/redhat-actions/buildah-build )** for related actions that can make use of this authentication.
2021-04-01 14:08:52 +05:30
2021-04-09 12:57:09 +05:30
This action only runs on `Linux` , as it uses [podman ](https://github.com/containers/Podman ) to perform the log in. [GitHub's Ubuntu action runners ](https://github.com/actions/virtual-environments#available-environments ) come with Podman preinstalled. If you are not using those runners, you must first [install Podman ](https://podman.io/getting-started/installation ).
2021-04-01 14:08:52 +05:30
< a id = "action-inputs" > < / a >
## Action Inputs
| Input Name | Description | Default |
| ---------- | ----------- | ------- |
2021-04-07 12:55:36 -04:00
| registry | Hostname/domain of the container image registry such as `quay.io` , `docker.io` . | **Must be provided**
2021-04-09 12:57:09 +05:30
| username | Username to log in against the container image registry. | **Must be provided**
2021-04-07 12:55:36 -04:00
| password | Password, encrypted password, or access token for `username` . | **Must be provided**
| logout | By default, the action logs out of the container image registry at the end of the job (for self-hosted runners). Set this to `false` to disable this behaviour. | `true`
2021-04-01 14:08:52 +05:30
2021-04-19 06:39:54 -06:00
## Examples
2021-04-01 14:08:52 +05:30
2021-04-09 12:57:09 +05:30
The example below shows how the `podman-login` action can be used to log in to `quay.io` container image registry.
2021-04-01 14:08:52 +05:30
```yaml
2021-04-09 12:57:09 +05:30
name: Log in to Quay.io
2021-04-01 14:08:52 +05:30
on:
push:
env:
2021-04-07 12:55:36 -04:00
REGISTRY_USER: quayuser
2021-04-01 14:08:52 +05:30
IMAGE_REGISTRY: quay.io
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
jobs:
login:
2021-04-07 12:55:36 -04:00
name: Log in to image registry
2021-04-01 14:08:52 +05:30
runs-on: ubuntu-20.04
steps:
2021-04-09 12:57:09 +05:30
- name: Log in to Quay.io
2021-04-01 14:08:52 +05:30
uses: redhat-actions/podman-login@v1
with:
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
registry: ${{ env.IMAGE_REGISTRY }}
2021-04-07 12:55:36 -04:00
# Now you can push images, and pull private ones, from quay.io as 'quayuser'.
2021-04-01 14:08:52 +05:30
```
2021-04-19 06:39:54 -06:00
2021-04-19 08:42:54 -04:00
Logging into GitHub's container registry is just as easy:
2021-04-19 06:39:54 -06:00
```yaml
name: Log in to ghcr.io
on:
push:
2021-04-19 08:42:54 -04:00
# Refer to https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context
# for information about the 'github' context object.
2021-04-19 06:39:54 -06:00
env:
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
jobs:
login:
name: Log in to GitHub Container Registry
runs-on: ubuntu-20.04
steps:
2021-04-19 08:42:54 -04:00
- name: Log in to ghcr.io
2021-04-19 06:39:54 -06:00
uses: redhat-actions/podman-login@v1
with:
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
registry: ${{ env.IMAGE_REGISTRY }}
# Now you can push images, and pull private ones, from ghcr.io.
```