如何将镜像推送到ECR仓库:

  ECR是一个私有的docker镜像存储库。
  
  ECR的组件:注册表、授权令牌、存储库、存储库策略、映像。
  
  注册表:每个AWS 账户均提供ECR的注册表,可以在注册表中创建映像的存储库,并在起中存储映像。
  
  授权令牌:docker客户端向ECR注册表推送和拉取映像,进行身份验证的令牌。
  
  存储库:存储docker映像的。
  
  存储库策略:通过存储库策略来控制对存储库映像的访问。
  
  映像:制作容器的镜像
  
  如何将镜像推送到ECR仓库:
  
  1.首先创建一个ECR镜像存储库;
  
  aws ecr create-repository --repository-name 存储库名称
  
  2.对镜像打tag;
  
  docker tag 镜像名称 aws_account_id.dkr.ecr.us-east-1.amazonaws.com/存储库名称
  
  3.获取注册表的身份验证字符串;(此命令提供的授权令牌在12小时有效)
  
  aws ecr get-login --no-include-email
  
  4.推送镜像到ECR;
  
  docker push aws_account_id.dkr.ecr.us-east-1.amazonaws.com/存储库
  
  5.删除存储库;
  
  aws ecr delete-repository --repository-name 存储库名称 --force
  
  在AWS 控制台上显示的是压缩后的镜像的大小,而使用docker images 看到的镜像是未压缩的。
  
  在控制台中ecr存储库的页面上可以看到映像的信息:
  
  image:有关在存储库中映像的信息;
  
  permissions: 存储库的权限策略;
  
  Lifecycle Polic(生命周期策略):存储库的生命周期策略规则;
  
  tags:存储库的元数据标签。
  
  AWS CLI tag的操作:
  
  标记现有存储库:
  
  aws ecr tag-resource --resource-arn arn:aws:ecr:region:account_id:repository:repository_name --tags Key=stack,Value=dev
  
  取消标记:
  
  aws ecr untag-resource --resource-arn arn:aws:ecr:region:account_id:repository:repository_name --tag-keys tag_key
  
  列出存储库的标签:
  
  aws ecr list-tags-for-resource --resource-arn arn:aws:ecr:region:account_id:repository:repository_name
  
  创建存储库并且应用标签:
  
  aws ecr create-repository --repository-name test-repo --tags Key=team,Value=devs
  
  Options:
  
  --config string Location of client config files (default "/root/.docker")
  
  -D, --debug Enable debug mode
  
  -H, --host list Daemon socket(www.tianscpt.com) to connect to
  
  -l, --log-level string Set the logging level (baihuiyulegw.com"debug"|"info"|"warn"|"error"|"fatal") (default "info")
  
  --tls Use TLS; implied by --tlsverify
  
  --tlscacert string Trust certs signed only by this CA (default "/root/.docker/ca.pem")
  
  --tlscert string Path to TLS certificate file (default "/root/.docker/cert.pem")
  
  --tlskey string Path to TLS key file (default "/root/.docker/key.pem")
  
  --tlsverify Use TLS and verify the remote
  
  -v, --version Print version information and quit
  
  Management Commands:
  
  builder Manage builds
  
  config Manage Docker configs
  
  container Manage containers
  
  engine Manage the docker engine
  
  image Manage images
  
  network Manage networks
  
  node Manage Swarm nodes
  
  plugin Manage plugins
  
  secret Manage Docker secrets
  
  service Manage services
  
  stack Manage Docker stacks
  
  swarm Manage Swarm
  
  system Manage Docker
  
  trust Manage trust on Docker images
  
  volume Manage volumes
  
  Commands:
  
  attach Attach local standard input, output, and error streams to a running container
  
  build Build an image from a Dockerfile
  
  commit Create a new image from a container‘s changes
  
  cp Copy files/folders between a container and the local filesystem
  
  create Create a new container
  
  diff Inspect changes to www.baihuidengLu.com files or directories on a container‘s filesystem
  
  events Get real time events from the server
  
  exec Run a command in a running container
  
  export Export a container‘s filesystem as a tar archive
  
  history Show the history of an image
  
  images List images
  
  import Import the contents from a tarball to create a filesystem image
  
  info Display system-wide information
  
  inspect Return low-level information on Docker objects
  
  kill Kill one or more running containers
  
  load Load an image from a tar archive or STDIN
  
  login Log in to a Docker registry
  
  logout Log out from a Docker registry
  
  logs Fetch the logs of a container
  
  pause Pause all processes within one or more containers
  
  port List port mappings or a specific mapping for the container
  
  ps List containers
  
  pull Pull an image or a repository from a registry
  
  push Push an image or a repository to a registry
  
  rename Rename a container
  
  restart Restart one or more containers
  
  rm Remove one or more containers
  
  rmi Remove one or more images
  
  run Run a command in a new container
  
  save Save one or more images to a tar archive (streamed to STDOUT by default)
  
  search Search the Docker Hub for images
  
  start Start one or more stopped containers
  
  stats Display a live stream of container(www.yunyouuyL.com ) resource usage statistics
  
  stop Stop one or more running containers
  
  tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
  
  top Display the running processes of a container
  
  unpause Unpause all processes within one or more containers
  
  update Update configuration of one or more containers
  
  version Show the Docker version information
  
  wait Block until one or more containers stop, then print their exit codes
  
  Docker Compose 命令附录#
  
  Copy
  
  $ docker-compose --help
  
  Define and run multi-container applications with Docker.
  
  Usage:
  
  docker-compose [-f <arg>...] [options] [COMMAND] [ARGS...]
  
  docker-compose -h|--help
  
  Options:
  
  -f, --file FILE Specify an alternate compose file
  
  (default:www.365soke.com docker-compose.yml)
  
  -p, --project-name NAME Specify an alternate project name
  
  (default: directory name)
  
  --verbose Show more output
  
  --log-level LEVEL Set log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
  
  --no-ansi Do not print ANSI control characters
  
  -v, --version Print version and exit
  
  -H, --host HOST Daemon socket to connect to
  
  --tls Use TLS; implied by --tlsverify
  
  --tlscacert CA_PATH Trust certs signed only by this CA
  
  --tlscert CLIENT_CERT_PATH Path to TLS certificate file
  
  --tlskey TLS_KEY_PATH Path to TLS key file
  
  --tlsverify Use TLS and verify the remote
  
  --skip-hostname-check Don‘t check the daemon‘s hostname against the
  
  name specified in the client certificate
  
  --project-directory PATH Specify an alternate working directory
  
  (default: the path of the Compose file)
  
  --compatibility If set, Compose will attempt to convert keys
  
  in v3 files to their non-Swarm equivalent
  
  Commands:
  
  build Build or rebuild services
  
  bundle Generate a Docker bundle from the Compose file
  
  config Validate and view the Compose file
  
  create Create services
  
  down Stop and remove containers, networks, images, and volumes
  
  events Receive real time events from containers
  
  exec Execute a command in a running container
  
  help Get help on a command
  
  images List images
  
  kill Kill containers
  
  logs View output from containers
  
  pause Pause services
  
  port Print the public port for a port binding
  
  ps List containers
  
  pull Pull service images
  
  push Push service images
  
  restart Restart services
  
  rm Remove stopped www.yongshi123.cn containers
  
  run Run a one-off command
  
  scale Set number of containers for a service
  
  start Start services
  
  stop Stop services
  
  top Display the running processes
  
  unpause Unpause services
  
  up Create and start containers
  
  version Show the Docker-Compose version information
  
  相关阅读#
  
  ASP.NET Core Docker Sample
  
  Dockerize a .NET Core application
  
  Best practices for writing Dockerfiles
  
  Fun With Docker-Compose Using .NET Core And NGINX
  
  ASP.NET Core 2.2: implementando Load Balancing com Nginx, Docker e Docker Compose
  
  作者:Esofar

原文地址:https://www.cnblogs.com/qwangxiao/p/10804377.html

时间: 2024-11-08 04:47:39

如何将镜像推送到ECR仓库:的相关文章

TortoiseGit学习系列之TortoiseGit基本操作将提交到本地的项目推送到在线仓库(图文详解)

前面博客 TortoiseGit学习系列之TortoiseGit基本操作修改提交项目(图文详解) TortoiseGit基本操作将提交到本地的项目推送到在线仓库 推送是提交的下一步操作. 在本地项目的空白处点击鼠标右键, 选择 TortoiseGit --> 推送... 或: Push.... 弹出推送(push)对话框: 一般保持默认,点击 "确定" 按钮. 然后弹出推送进度界面,可能要求你输入用户名: 确定OK,然后要求输入密码: 密码输入正确后,OK,显示推送成功界面:  

使用git命令将本地项目推送到远程仓库

将本地项目推送到远程仓库 这里先放一张图, 有助于理解git命令 1. 在GitHub上新建一个仓库 注意不要勾选自动生成README.md文件, 否则会产生某些问题, README.md文件到时可以在本地项目文件夹内创新好, 再同步到远程仓库 2. 创建一个存储项目的文件夹, 并进入文件夹下 3.创建本地仓库 git init 4. 创建README.md 5. 同步远程仓库git remote add origin 'HTTPS' 备注: 'HTTPS'替换为仓库链接 6. 添加到Index

Git 创建远程仓库并克隆到本地,创建本地仓库并推送到远程仓库

配置用户信息 配置的是你个人的用户名称和电子邮件地址.这两条配置很重要,每次 Git 提交时都会引用这两条信息,说明是谁提交了更新,会随更新内容一起被永久纳入历史记录 git config --global user.name "testerDong" git config --global user.email "[email protected]" 1.创建远程仓库,克隆远程仓库到本地 a.先在GitHub上创建一个远程仓库 b.复制该仓库SSH地址 c.git

如何推送到远程仓库

将本地项目上传到Github(两种简单.方便的方法) 一.第一种方法: 首先你需要一个github账号,所有还没有的话先去注册吧! https://github.com/ 我们使用git需要先安装git工具,这里给出下载地址,下载后一路直接安装即可: https://git-for-windows.github.io/ 1.进入Github首页,点击New repository新建一个项目 2.填写相应信息后点击create即可 Repository name: 仓库名称 Description

创建镜像推送至仓库

用commit命令创建镜像 先创建一个容器,在容器里做出修改,最后将该容器提交为一个新镜像 创建容器 docker run -it --name test001 ubuntu /bin/bash 修改容器 apt-get install vim 退出容器 exit 提交定制容器 docker commit -m'提交信息' -a'作者信息' 容器ID idktp/myimage:tag # "idktp/myimage:tag"为镜像名称. # 其中idktp为个人Docker用户名,

Git学习——把文件推送到远程仓库

本地仓库与GitHub仓库关联 git remote add origin [email protected]:<github账户名>/<github的仓库名>.git 把本地库的所有内容推送到远程库上 git push -u origin master //第一次推送master分支 加上-u参数,不但会把本地的master分支内容推送的远程新的master分支,还会把本地的master分支和远程的master分支关联起来,在以后的推送或者拉取时就可以简化命令. 原文地址:htt

Git 推送到远程仓库

github:https://github.com/ 国内的:https://gitee.com/ (和Github非常相似的) 一.Http方式进行推送 右击同步,配置远端,将URL替换成远程仓库的地址 直径进行推送就行,使用HTTP不需要进行秘钥只需要数据用户名和密码 二.SSH方式进行推送 使用命令行进行 1.产生公钥和秘钥: 2.复制公钥内容 3.建立和Github连接并提交到仓库 使用图形工具进行操作: 1.右击-->同步 2.建立关联关系 3.确定网络选择的SSH客户端 4.填写名字

推送至远程仓库使用git push -u的原因

第一次把本地仓库推送至远端时,为了以后方便一定要使用 git push -u origin master [此处是把本地的master分支推送至远程的master分支] 原文地址:https://www.cnblogs.com/come202011/p/12203315.html

gitLab本地推送到远程仓库的命令

如果git remote add origin时提示说在远程仓库有origin了,可以选择git remote rm origin或者换个其他任意的字符串.