简体   繁体   English

如何使用 docker-compose 下载私有镜像(本地)

[英]How to download private image (locally) using docker-compose

This is my first time posting on here so apologies in advance if my question is quite broad or not structured well I have recently set-up my ci/cd pipeline and created my container registry successfully.这是我第一次在这里发帖,所以如果我的问题非常广泛或结构不好,请提前道歉,我最近设置了我的 ci/cd 管道并成功创建了我的容器注册表。 This is my gitlab-ci.yml file这是我的 gitlab-ci.yml 文件

gitlab-ci.yml file gitlab-ci.yml 文件

My current goal is to download the private image (Locally) created on GitLab using docker-compose.我目前的目标是使用 docker-compose 下载在 GitLab 上创建的私有图像(本地)。 I am kind of lost as to what this process looks like.我对这个过程的样子有点迷茫。 Any help will be much appreciated even if its referencing documentation.任何帮助将不胜感激,即使它的参考文档。

Thanks in advance!!提前致谢!!

In your docker-compose file you have to write the full image name.在您的 docker-compose 文件中,您必须写入完整的图像名称。 but first you have to login to that registry但首先您必须登录该注册表

docker login <<docker-registry>> Enter your username and password for that docker-registry. docker login <<docker-registry>>输入该 docker-registry 的用户名和密码。

Now if you run this command it should work docker pull <<docker-registry>>/yourImage现在,如果您运行此命令,它应该可以工作docker pull <<docker-registry>>/yourImage

and this is docker-copmose example这是 docker-copmose 示例

version: '3'

services:
  postgresql:
    image: <<docker-rigstry>>/postgres:9.11
    container_name: pg-docker
    ports:
      - "5400:5432"
    environment:
      - POSTGRES_USER=docker
      - POSTGRES_PASSWORD=docker
    volumes:
      - ./postgres.conf:/etc/postgresql/postgresql.conf
    command: postgres -c config_file=/etc/postgresql/postgresql.conf
    restart: always 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 How to build Docker Image using Docker or docker-compose from a Private Github Repo or Github Enterprise repo? - How to build Docker Image using Docker or docker-compose from a Private Github Repo or Github Enterprise repo? 如何正确使用 docker-compose 文件中本地构建的镜像? - How to use locally built image in docker-compose file correctly? 如何 docker-compose 托管在 Digital Ocean 私人仓库中的图像? - How to docker-compose an image hosted in a Digital Ocean private repo? 使用docker hub时如何强制docker-compose下载新镜像? - How to force docker-compose to download a new image when using docker hub? 使用本地加载的图像 docker-compose - Using locally loaded images with docker-compose 如何使用 Docker-compose 构建 Loki 服务器 Docker 映像 - How to build a Loki server Docker image using Docker-compose 构建 docker 镜像,通过 docker-compose,使用本地运行的 verdaccio - Build docker image, through docker-compose, using locally running verdaccio 如何使用正则表达式在docker-compose文件中指定docker镜像 - How to specify a docker image in docker-compose file using regex 无法使用 docker-compose 从 Docker 映像中克隆私有 Bitbucket 存储库 - Cannot clone a private Bitbucket repo from inside a Docker image using docker-compose 如何用 docker-compose 标记 docker 图像 - How to tag docker image with docker-compose
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM