Prerequisites
- A valid email address
- A credit card for billing (GCP offers a free tier and $300 in free credits for new users)
Step 1: Create a GCP Account
- Go to the Google Cloud Platform website.
- Click on the Get started for free button.
- Follow the on-screen instructions to create a new Google account or sign in with an existing Google account.
- Set up your billing information to access the free tier and free credits.
Step 2: Set Up a New Project
- Once logged into the GCP Console, click on the Select a project dropdown at the top of the page.
- Click on New Project.
- Enter a project name, select a billing account, and choose a location.
- Click on Create.
Step 3: Enable the Artifact Registry API
- In the GCP Console, go to the Navigation menu > API & Services > Library.
- Search for Artifact Registry API.
- Click on Artifact Registry API and then click on Enable.
Step 4: Ensure Necessary Permissions
- As the owner of the project, you already have the necessary permissions to manage Artifact Registry repositories. If you are using a different account, ensure that it has the Editor role at the project level.
Step 5: Install and Configure Google Cloud SDK (gcloud CLI)
- Download and install the Google Cloud SDK.
- Open a terminal or command prompt.
- Initialize the SDK with the following command:
- Follow the on-screen prompts to log in with your Google account and set the default project.
Step 6: Authenticate the CLI Using Application-Default Login
- Authenticate the gcloud CLI with your user account:
Follow the on-screen prompts to log in with your Google account. This command sets up application-default credentials for the CLI.
Step 7: Configure Docker to Use Google Artifact Registry
- Install Docker if it is not already installed. Follow the instructions on the Docker website to install Docker for your operating system.
- Configure Docker to authenticate with Google Artifact Registry:
us-central1
with the region where your repository is located.
Step 8: Create a Repository
- Create an Artifact Registry repository:
REPOSITORY_NAME
with the desired name of your repository andLOCATION
with your preferred GCP region (e.g.,us-central1
).
Step 9: Make the Repository Public
- In the GCP Console, go to the Navigation menu > Artifact Registry > Repositories.
- Click on the repository you want to make public.
- Click on the Permissions tab.
- Click on Add principal.
- In the New principals field, enter
allUsers
. - In the Select a role dropdown, choose Artifact Registry > Artifact Registry Reader.
- Click on Save.
Step 10: Verify the Image in Google Artifact Registry
- In the GCP Console, go to the Navigation menu > Artifact Registry > Repositories > REPOSITORY_NAME.
- You should see the image you pushed listed under your repository.
Additional Considerations: Quotas
By default, GCP provides sufficient quotas for most users. However, if you need to increase quotas for your project:- Go to the Navigation menu > IAM & Admin > Quotas.
- Filter by the quota you need to increase (e.g.,
Artifact Registry storage
). - Select the quota and click on Edit Quotas.
- Fill out the request form and submit it. Google will review your request and notify you of the outcome.