Code Monkey home page Code Monkey logo

docker-login's Introduction

Log in to a container registry

Use this GitHub Action to log in to a private container registry such as Azure Container registry. Once login is done, the next set of actions in the workflow can perform tasks such as building, tagging and pushing containers.

- uses: azure/docker-login@v1
  with:
    login-server: '<login server>' # default: index.docker.io
    username: '<username>'
    password: '<password>'

Refer to the action metadata file for details about all the inputs: action.yml

When using the docker-login action, ensure your login-server matches the fully qualified path to your image. You should omit login-server if you are pushing to the default docker hub without a host prefix, for instance, docker push repo/image. You'll need to specify a login-server if you are using the fully qualified path: docker push index.docker.io/repo/image.

Logging in to multiple registries

To log in to multiple registries, simply run this action several times with different credentials; they will accumulate.

- uses: azure/docker-login@v1
  with:
    login-server: contoso.azurecr.io
    username: ${{ secrets.ACR_USERNAME }}
    password: ${{ secrets.ACR_PASSWORD }}
- uses: azure/docker-login@v1
  with:
    login-server: index.docker.io
    username: ${{ secrets.DOCKERIO_USERNAME }}
    password: ${{ secrets.DOCKERIO_PASSWORD }}
- run: |
    docker pull contoso.azurecr.io/private/image:latest
    docker pull private/image:latest

You can build and push container registry by using the following example

- uses: azure/docker-login@v1
  with:
    login-server: contoso.azurecr.io
    username: ${{ secrets.REGISTRY_USERNAME }}
    password: ${{ secrets.REGISTRY_PASSWORD }}

- run: |
    docker build . -t contoso.azurecr.io/k8sdemo:${{ github.sha }}
    docker push contoso.azurecr.io/k8sdemo:${{ github.sha }}

Prerequisite

Get the username and password of your container registry and create secrets for them. For Azure Container registry refer to admin account document for username and password.

Now add the username and password as a secret in the GitHub repository.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

docker-login's People

Contributors

addnab avatar ajinkya599 avatar balaga-gayatri avatar dependabot[bot] avatar josh-01 avatar mhamrah avatar microsoftopensource avatar msftgits avatar n-usha avatar roopeshnair avatar shigupt202 avatar squarebracket avatar stephenmichaelf avatar stoyanstatanasov avatar sundargs2000 avatar thesattiraju avatar tjsiron avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.