Working with the Docker registry

You can push and pull your Docker images using the Paquetes de GitHub Docker registry, which uses the package namespace https://docker.pkg.github.com.

Paquetes de GitHub is available with GitHub Free, GitHub Pro, GitHub Free for organizations, GitHub Team, GitHub Enterprise Cloud, Servidor de GitHub Enterprise 2.22, and GitHub One.

Note: Paquetes de GitHub is currently in beta for Servidor de GitHub Enterprise 2.22. To join the beta for your instance, use the sign-up form.

Note: Paquetes de GitHub is currently in beta for GitHub AE.

Note: This package type may not be available for your instance, because site administrators can enable or disable each supported package type. For more information, see "Configuring packages support for your enterprise."

About Docker support

When installing or publishing a Docker image, the Docker registry does not currently support foreign layers, such as Windows images.

Authenticating to Paquetes de GitHub

Necesitas de un token de acceso para publicar, instalar, y borrar paquetes en Paquetes de GitHub. Puedes utilizar un token de acceso personal para autenticarte con tu nombre de usuario directamente en Paquetes de GitHub o en la API de GitHub. Cuando creas un token de acceso personal, puedes asignar al token diferentes ámbitos en función de tus necesidades.

To authenticate to Paquetes de GitHub using a GitHub Actions workflow, you must use GITHUB_TOKEN.

For more information about GITHUB_TOKEN used in GitHub Actions workflows, see "Authentication in a workflow."

Authenticating with a personal access token

Debes utilizar un token de acceso personal con los alcances adecuados para publicar e instalar paquetes en Paquetes de GitHub. Para obtener más información, consulta "Acerca de Paquetes de GitHub".

You can authenticate to Paquetes de GitHub with Docker using the docker login command.

To keep your credentials secure, we recommend you save your personal access token in a local file on your computer and use Docker's --password-stdin flag, which reads your token from a local file.

$ cat ~/TOKEN.txt | docker login docker.HOSTNAME -u USERNAME --password-stdin

To use this example login command, replace USERNAME with your GitHub Enterprise username, HOSTNAME with the URL for tu instancia de servidor de GitHub Enterprise, and ~/TOKEN.txt with the file path to your personal access token for GitHub Enterprise.

For more information, see "Docker login."

Publishing an image

Note: The Paquetes de GitHub Docker registry will be superseded by in a future GitHub Enterprise release.

Note: Image names must only use lowercase letters.

Paquetes de GitHub supports multiple top-level Docker images per repository. A repository can have any number of image tags. You may experience degraded service publishing or installing Docker images larger than 10GB, layers are capped at 5GB each. For more information, see "Docker tag" in the Docker documentation.

Después de que publiques un paquete, puedes verlo en GitHub. Para obtener más información, consulta "Visualizar paquetes".

  1. Determine the image name and ID for your docker image using docker images.

    $ docker images
    > < >
    > REPOSITORY        TAG        IMAGE ID       CREATED      SIZE
    > IMAGE_NAME        VERSION    IMAGE_ID       4 weeks ago  1.11MB
  2. Using the Docker image ID, tag the docker image, replacing OWNER with the name of the user or organization account that owns the repository, REPOSITORY with the name of the repository containing your project, IMAGE_NAME with name of the package or image, HOSTNAME with the hostname of tu instancia de servidor de GitHub Enterprise, and VERSION with package version at build time.

    $ docker tag IMAGE_ID docker.HOSTNAME/OWNER/REPOSITORY/IMAGE_NAME:VERSION
  3. If you haven't already built a docker image for the package, build the image, replacing OWNER with the name of the user or organization account that owns the repository, REPOSITORY with the name of the repository containing your project, IMAGE_NAME with name of the package or image, VERSION with package version at build time, HOSTNAME with the hostname of tu instancia de servidor de GitHub Enterprise, and PATH to the image if it isn't in the current working directory.

    $ docker build -t docker.HOSTNAME/OWNER/REPOSITORY/IMAGE_NAME:VERSION PATH
  4. Publish the image to Paquetes de GitHub.

    $ docker push docker.HOSTNAME/OWNER/REPOSITORY/IMAGE_NAME:VERSION

    Note: You must push your image using IMAGE_NAME:VERSION and not using IMAGE_NAME:SHA.

Example publishing a Docker image

You can publish version 1.0 of the monalisa image to the octocat/octo-app repository using an image ID.

$ docker images

> REPOSITORY           TAG      IMAGE ID      CREATED      SIZE
> monalisa             1.0      c75bebcdd211  4 weeks ago  1.11MB

# Tag the image with OWNER/REPO/IMAGE_NAME
$ docker tag c75bebcdd211 docker.HOSTNAME/octocat/octo-app/monalisa:1.0

# Push the image to Paquetes de GitHub
$ docker push docker.HOSTNAME/octocat/octo-app/monalisa:1.0

You can publish a new Docker image for the first time and name it monalisa.

# Build the image with docker.HOSTNAME/OWNER/REPOSITORY/IMAGE_NAME:VERSION
# Assumes Dockerfile resides in the current working directory (.)
$ docker build -t docker.HOSTNAME/octocat/octo-app/monalisa:1.0 .

# Push the image to Paquetes de GitHub
$ docker push docker.HOSTNAME/octocat/octo-app/monalisa:1.0

Downloading an image

Note: The Paquetes de GitHub Docker registry will be superseded by in a future GitHub Enterprise release.

You can use the docker pull command to install a docker image from Paquetes de GitHub, replacing OWNER with the name of the user or organization account that owns the repository, REPOSITORY with the name of the repository containing your project, IMAGE_NAME with name of the package or image, HOSTNAME with the host name of tu instancia de servidor de GitHub Enterprise, and TAG_NAME with tag for the image you want to install.

$ docker pull docker.HOSTNAME/OWNER/REPOSITORY/IMAGE_NAME:TAG_NAME

Note: You must pull the image using IMAGE_NAME:VERSION and not using IMAGE_NAME:SHA.

Further reading

Did this doc help you?Privacy policy

Help us make these docs great!

All GitHub docs are open source. See something that's wrong or unclear? Submit a pull request.

Make a contribution

O, learn how to contribute.