如何將鏡像推送到ECR倉庫:
阿新 • • 發佈:2019-05-03
and input 令牌 proc project swarm mission sig daemon
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
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
如何將鏡像推送到ECR倉庫: