ECR 是一个私有的 docker 镜像存储库.
ECR 的组件: 注册表, 授权令牌, 存储库, 存储库策略, 映像.
注册表: 每个 AWS 账户均提供 ECR 的注册表, 可以在注册表中创建映像的存储库, 并在起中存储映像.
授权令牌: docker 客户端向 ECR 注册表推送和拉取映像, 进行身份验证的令牌.
存储库: 存储 docker 映像的.
存储库策略: 通过存储库策略来控制对存储库映像的访问.
映像: 制作容器的镜像
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 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
- Copy
- $ docker-compose --help
- 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.YAML)
- -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
- 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
来源: http://www.bubuko.com/infodetail-3044921.html