Howto::Docker Registry: Difference between revisions

From Computer Science Wiki
Jump to navigation Jump to search
Carnold (talk | contribs)
Carnold (talk | contribs)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Introduction ==
== Introduction ==
We offer a docker image registry service tied with https://git.cs.vt.edu that offers a place to share your docker images and version control them.  This is a quick start guide on how to use our docker registry.
We offer a docker image registry service tied with Gitlab that offers a place to share your docker images and version control them.  This is a quick start guide on how to use our docker registry. There are two instances of Gitlab with different URLs:
* https://version.cs.vt.edu -> docker.cs.vt.edu (Image Registry URL)
* https://git.cs.vt.edu -> container.cs.vt.edu (Image Registry URL)


== Create Project ==
== Create Project ==
First you must create a project in git.cs.vt.edu to store your images or make sure registry is enabled on an existing project. For new projects, the registry is automatically enabled.  For an older project you must enable it:
First you must create a project in Gitlab to store your images or use an existing project.
# Login into https://git.cs.vt.edu
# Open the project
# Go to "Settings->General"
# Expand "Permissions"
# Make sure "Container registry" is checked
[[File:Git_reg_perm.jpg]]


== Using Registry ==
== Using Registry ==
Line 23: Line 19:
** docker.cs.vt.edu/<username>/<project>/<image>:<tag>
** docker.cs.vt.edu/<username>/<project>/<image>:<tag>
* You tag your docker build with the image URL, example:
* You tag your docker build with the image URL, example:
** <code>docker build -t docker.cs.vt.edu/carnold/project1/testimage .</code>
** <code>docker build -t docker.cs.vt.edu/carnold/library/hello .</code>
* Push the image up to your registry
* Push the image up to your registry
** <code>docker push docker.cs.vt.edu/carnold/project1/testimage</code>
** <code>docker push docker.cs.vt.edu/carnold/library/hello</code>


=== Running an image ===
=== Running an image ===
* <code>docker run docker.cs.vt.edu/carnold/project1/testimage:latest</code>
* <code>docker run docker.cs.vt.edu/carnold/library/hello:latest</code>


== Public Vs. Internal Vs. Private ==
== Public vs. Internal vs. Private ==
=== Public ===
=== Public ===
If your project is set as "public", this will allow anyone on the Internet to be able to download use your images.
If your project is set as "public", this will allow anyone on the Internet to be able to download and use your images.
=== Internal ===
=== Internal ===
If your project is set as "internal", then anyone with access to git.cs.vt.edu can download and use the images after they login with their login.
If your project is set as "internal", then anyone with access to git.cs.vt.edu can download and use the images after they login with their login.
=== Private ===
=== Private ===
If your project is set as "private", then only you will be able download and use the images after you login.  Unless you create a deploy token.
If your project is set as "private", then only you will be able download and use the images after you login.  Unless you create a deploy token:
=== Deploy Token ===
=== Deploy Token ===
You can create a "deploy token" that will allow anyone you share the token with to download and use your images.  The user will login with your username and the token as the password.  Tokens expire after a time limit.  Note: once downloaded the client will have a cached copy of the images, even after the token expires.  Find out more about deploy tokens: https://docs.gitlab.com/ce/user/project/deploy_tokens/index.html
You can create a "deploy token" that will allow anyone you share the token with to download and use your images.  The user will login with the token username and password.  Tokens expire after a time limit.  Note: once downloaded the client will have a cached copy of the images, even after the token expires or is revoked.  Find out more about deploy tokens: https://docs.gitlab.com/ce/user/project/deploy_tokens/index.html

Latest revision as of 15:24, 18 April 2022

Introduction

We offer a docker image registry service tied with Gitlab that offers a place to share your docker images and version control them. This is a quick start guide on how to use our docker registry. There are two instances of Gitlab with different URLs:

Create Project

First you must create a project in Gitlab to store your images or use an existing project.

Using Registry

These commands are run on your development machine.

Log into registry

To be able to push images up to your registry, you must log in

  • docker login docker.cs.vt.edu

Build and push image

Example of building your docker image and uploading it to your registry

  • Determine your image's URL with optional tag:
    • docker.cs.vt.edu/<username>/<project>/<image>:<tag>
  • You tag your docker build with the image URL, example:
    • docker build -t docker.cs.vt.edu/carnold/library/hello .
  • Push the image up to your registry
    • docker push docker.cs.vt.edu/carnold/library/hello

Running an image

  • docker run docker.cs.vt.edu/carnold/library/hello:latest

Public vs. Internal vs. Private

Public

If your project is set as "public", this will allow anyone on the Internet to be able to download and use your images.

Internal

If your project is set as "internal", then anyone with access to git.cs.vt.edu can download and use the images after they login with their login.

Private

If your project is set as "private", then only you will be able download and use the images after you login. Unless you create a deploy token:

Deploy Token

You can create a "deploy token" that will allow anyone you share the token with to download and use your images. The user will login with the token username and password. Tokens expire after a time limit. Note: once downloaded the client will have a cached copy of the images, even after the token expires or is revoked. Find out more about deploy tokens: https://docs.gitlab.com/ce/user/project/deploy_tokens/index.html