DEV Community

Suave Bajaj
Suave Bajaj

Posted on

Jfrog Docker Challenge

PREREQUISITE: Must have Docker installed (https://docs.docker.com/get-docker/)
Docker Challenge : https://jfrog.com/docker-challenge/

Step 1 - LOGIN TO YOUR ENVIRONMENT

Login to the SaaS URL with the JFrog Platform credentials.

STEP 2 - ADD LOCAL DOCKER REPOSITORY

Adding a local docker repository that will be used to store your custom docker image you will create in a later step.

  • Navigate to the Administration Module. Expand the Repositories menu and click on the Repositories menu item.
  • Add a new Local Repository with the Docker package type.
  • Enter the Repository Key docker-dev-local and
  • Keep the rest of the default settings.

STEP 3 - ADD REMOTE DOCKER REPOSITORY

Adding a remote repository that will be used to store needed 3rd party images from Docker Hub.

  • Click on the Remote tab on the Repositories page and add a new Remote Repository with the Docker package type.
  • Enter the Repository Key docker-hub-remote
  • Keep the rest of the default settings.

Step 4 - ADD VIRTUAL DOCKER REPOSITORY

Add a virtual docker repository that you will use when creating your custom docker image.

  • Click on the Virtual tab on the Repositories page and add a new Virtual Repository with the Docker package type.
  • Enter the Repository Key docker and add the local and remote docker repositories you created in Steps 2 and 3.
  • Select your local repository that you created in Step 2 as the Default Deployment Repository.
  • Keep the rest of the default settings.

Step 5 - FORK THE JFROG DOCKER EXAMPLE GITHUB REPO

Fork the JFrog Docker example repo: https://github.com/jfrog/jfrog-docker-repo-simple-example

This repo contains a simple Dockerfile you will use to build your custom image.

Step 6 - UPDATE THE BASE IMAGE REFERENCE

Clone your forked repository and update the FROM line of the Dockerfile to reference your virtual
docker repository.

FROM 
{SERVER_NAME}.jfrog.io/{VIRTUAL_REPO_NAME}/alpine:3.11.5
Enter fullscreen mode Exit fullscreen mode

The SERVER_NAME is the first part of the URL given to you for your environment: https://-
SERVER_NAME.jfrog.io

The VIRTUAL_REPO_NAME is the name โ€œdockerโ€ that you assigned to your virtual repository in Step 4.

Step 7 - PUSH CUSTOM IMAGE TO YOUR DOCKER REPOSITORY

Log in to your virtual repository, build, tag and push your custom image with the following commands:

$ docker login {SERVER_NAME}.jfrog.io
Enter fullscreen mode Exit fullscreen mode
$ docker build --tag 
{SERVER_NAME}.jfrog.io/{VIRTUAL_REPO_NAME}/my-docker-image:latest .
Enter fullscreen mode Exit fullscreen mode
$ docker push {SERVER_NAME}.jfrog.io/{VIRTUAL_REPO_NAME}/my-docker-image:latest
Enter fullscreen mode Exit fullscreen mode

You have now successfully pushed your docker image to Jfrog repo

For the last step,

  • Navigate to the Application Module, expand the Artifactory menu and click the Artifacts menu item.
  • In the Artifact Tree View, expand the docker, the docker-dev-local and the docker-hub-remote repositories to show your new artifacts.
  • Click on your image in your docker-dev-local repository to see its details.

  • Submit your screenshot of the completed challenge to https://jfrog.co/tshirt-challenge along
    with your shipping information!

Top comments (0)