Frecuentemente publicamos actualizaciones de nuestra documentación. Es posible que la traducción de esta página esté en curso. Para conocer la información más actual, visita la documentación en inglés. Si existe un problema con las traducciones en esta página, por favor infórmanos.
GitHub AE está actualmente en un lanzamiento limitado. Por favor, contacta a nuestro equipo de ventas para conocer más sobre esto.

Working with the Docker registry

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

el Registro del paquete de GitHub se encuentra disponible con GitHub Free, GitHub Pro, GitHub Free para organizaciones, GitHub Team, Nube de GitHub Enterprise, GitHub Enterprise Server, y GitHub AE.

Nota: El Registro del paquete de GitHub se encuentra actualmente en beta para GitHub AE.

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 Registro del paquete de GitHub

You need an access token to publish, install, and delete packages.

You can use a personal access token (PAT) to authenticate to Registro del paquete de GitHub or the GitHub AE API. When you create a personal access token, you can assign the token different scopes depending on your needs. For more information about packages-related scopes for a PAT, see "About permissions for GitHub Packages."

To authenticate to a Registro del paquete de GitHub registry within a GitHub Actions workflow, you can use:

  • GITHUB_TOKEN to publish packages associated with the workflow repository.
  • a PAT to install packages associated with other private repositories (which GITHUB_TOKEN can't access).

Para obtener más información sobre el GITHUB_TOKEN que se utiliza en los flujos de trabajo de GitHub Actions, consulta la sección "Autenticarse en un flujo de trabajo".

Authenticating with a personal access token

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

You can authenticate to Registro del paquete 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 AE username, HOSTNAME with the URL for tu empresa, and ~/TOKEN.txt with the file path to your personal access token for GitHub AE.

For more information, see "Docker login."

Publishing an image

Nota: El Registro de Docker del Registro del paquete de GitHub se suspenderá en un lanzamiento subsecuente de GitHub AE por el Registro de contenedores, el cual ofrece compatibilidad de contenedores mejorada.

Note: Image names must only use lowercase letters.

Registro del paquete 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 empresa, 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 empresa, 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 Registro del paquete 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 Registro del paquete 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 Registro del paquete de GitHub
$ docker push docker.HOSTNAME/octocat/octo-app/monalisa:1.0

Downloading an image

Nota: El Registro de Docker del Registro del paquete de GitHub se suspenderá en un lanzamiento subsecuente de GitHub AE por el Registro de contenedores, el cual ofrece compatibilidad de contenedores mejorada.

You can use the docker pull command to install a docker image from Registro del paquete 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 empresa, 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

¿Te ayudó este documento?

Política de privacidad

¡Ayúdanos a hacer geniales estos documentos!

Todos los documentos de GitHub son de código abierto. ¿Notas algo que esté mal o que no sea claro? Emite una solicitud de cambios.

Haz una contribución

O, aprende cómo contribuir.