Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consuming The Newly Created Docker Image #4

Open
github-learning-lab bot opened this issue Jun 28, 2021 · 4 comments
Open

Consuming The Newly Created Docker Image #4

github-learning-lab bot opened this issue Jun 28, 2021 · 4 comments

Comments

@github-learning-lab
Copy link
Contributor

Using your new Docker Image package

The easiest way to use your Docker Image package is to click the package name from the package tab.
screenshot of packages, highlighting the tic-tac-toe title

That will bring you to a screen like containing instructions.
screenshot of tic-tac-toe package page


Before we can use this Docker image, you will need to generate a personal access token that contains the following permissions:

  • repo (all)
  • write:packages
  • read:packages

screenshot personal access token creation page with boxes for repo (all), write:packages, and read:packages checked

We will use this token to log in to Docker, and authenticate with the package.

@github-learning-lab
Copy link
Contributor Author

Step 4: Log in to Docker

⌨️ Activity: Log in to Docker

  1. Open your terminal (Bash or Git Bash recommended)
  2. Use the following command to log in:
    docker login docker.pkg.github.com -u USERNAME -p TOKEN
    
  3. Replace USERNAME with your GitHub username
  4. Replace TOKEN with the Personal Access Token you just created
  5. Press Enter

If everything went well, 🤞 you should see Login Succeeded in your terminal.

@github-learning-lab
Copy link
Contributor Author

Step 5: Pull your image

⌨️ Pull the image from GitHub Packages to your local environment

  1. Copy and paste the pull command from the package instructions into your terminal. It should look something like this:
  • docker pull docker.pkg.github.com/fede843/js-build/tic-tac-toe:f29
    screenshot of the pull command on the GitHub package page
  1. Press Enter

You should see output indicating that the pull was successful, like Status: Downloaded newer image for docker.

screenshot of successful Docker image output

@github-learning-lab
Copy link
Contributor Author

Step 6: Run your Docker Image

⌨️ Activity: Run your image locally

  1. Find your image information by typing Docker image ls
    screenshot of output from Docker image ls command: lists docker images, REPOSITORY TAG and docker URL
  2. Use the following command to run a container from your image:
    docker run -d -it --rm -p 8080:80 --name ttt <YOUR_IMAGE_NAME:TAG>
  3. Replace YOUR_IMAGE_NAME with your image name under the REPOSITORY column
  4. Replace TAG with the image tag under the TAG column
    example of running the docker command listed above
  5. Press Enter

If everything went well, you will see hash value as output on your screen.

@github-learning-lab
Copy link
Contributor Author

Congratulations! 🎉

Congratulations @fede843, you did it! You wrote a workflow that sends a code through a CI/CD pipeline and leaves you will a fully tested, fully deployable artifact.

You did so using GitHub Actions and GitHub Packages!

This concludes our course. Close this issue when you are done. You are free to keep this repository for future reference as you go out and build cool things on the internet!

celebrate

What's next?

We hope this course helped you feel more comfortable using GitHub. Remember: You’re always welcome to repeat course topics if you’d like additional practice. If you’re ready to build on your new skills, here are some ideas.

Contribute to a project

To find projects to contribute to through trending topics and curated collections, check out GitHub Explore.

Keep learning

What will you learn next?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants