我正在将docker镜像推送到AWS ecr。问题是ECR图像没有更新。顺便说一下,这一切都在gitlab管道中运行。
running: docker run 00boilerplate/api-service /bin/bash -c "cat /root/base_service_container/api-nginx.conf"
here in eval command
command: docker run 00boilerplate/api-service /bin/bash -c "cat /root/base_service_container/api-nginx.conf"
output: server {
listen 80;
server_name localhost;
charset utf-8;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
sendfile on;
client_max_body_size 20M;
keepalive_timeout 0;
location /static {
alias /root/base_service_container/api-service/static;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/tmp/api-uwsgi.sock;
# The following was taken from: http://enable-cors.org/server_nginx.html
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PATCH, PUT, DELETE';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
#
# Tell client that this pre-flight info is valid for 20 days
#
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
}
}
running: docker tag 00boilerplate/api-service 844373124958.dkr.ecr.us-west-2.amazonaws.com/00boilerplate/api-service:latest
here in eval command
command: docker tag 00boilerplate/api-service 844373124958.dkr.ecr.us-west-2.amazonaws.com/00boilerplate/api-service:latest
output:
_repository: {u'repositoryArn': u'arn:aws:ecr:us-west-2:844373124958:repository/00boilerplate/api-service', u'repositoryName': u'00boilerplate/api-service', u'registryId': u'844373124958', u'createdAt': 1495615399.0, u'repositoryUri': u'844373124958.dkr.ecr.us-west-2.amazonaws.com/00boilerplate/api-service'}
running: docker push 844373124958.dkr.ecr.us-west-2.amazonaws.com/00boilerplate/api-service:latest
here in eval command
command: docker push 844373124958.dkr.ecr.us-west-2.amazonaws.com/00boilerplate/api-service:latest
output: The push refers to a repository [844373124958.dkr.ecr.us-west-2.amazonaws.com/00boilerplate/api-service]
ce4ac46c05a6: Preparing [repeated several times]
db782c8e6f00: Waiting [repeated several times]
ce4ac46c05a6: Pushed [repeated several times]
latest: digest: sha256:[THE SHA CODE] size: [THE SHA SIZE]
Image 00boilerplate/api-service successfully pushed to 00boilerplate/api-service repository.
所以,正如你可以看到码头声称它已成功推动。然而,当我拉动并捕捉api-nginx.conf时,它与我推动的图像中的那个不同(即缺少/静态路径)。
(venv)Govindas-MacBook-Pro:api-service govindadasu$ docker pull 844373124958.dkr.ecr.us-west-2.amazonaws.com/00boilerplate/api-service:latest
latest: Pulling from 00boilerplate/api-service
386a066cd84a: Pull complete [repeated several times]
Digest: sha256:ff6c1fe9316e7a412436209a49a4b2bdbba9c012cb803a3cb734ab54642b7c66
Status: Downloaded newer image for 844373124958.dkr.ecr.us-west-2.amazonaws.com/00boilerplate/api-service:latest
(venv)Govindas-MacBook-Pro:api-service govindadasu$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
844373124958.dkr.ecr.us-west-2.amazonaws.com/00boilerplate/api-service latest fd8ca67df522 2 months ago 1.26 GB
hello-world latest 48b5124b2768 4 months ago 1.84 kB
(venv)Govindas-MacBook-Pro:api-service govindadasu$ docker run -i -t fd8ca67df522 /bin/bash
root@927e1c04055e:~/base_service_container/api-service# ls
Dockerfile api-uwsgi.ini before_run.sh boilerplate_draj ci_tests.sh manage.py scripts
root@927e1c04055e:~/base_service_container/api-service# cat ../api-nginx.conf
server {
listen 80;
server_name localhost;
charset utf-8;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
sendfile on;
client_max_body_size 20M;
keepalive_timeout 0;
location / {
include uwsgi_params;
uwsgi_pass unix:/tmp/api-uwsgi.sock;
# The following was taken from: http://enable-cors.org/server_nginx.html
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PATCH, PUT, DELETE';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
#
# Tell client that this pre-flight info is valid for 20 days
#
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
}
}
因为您可以看到我在本地计算机上提取图像时,api-nginx.conf文件与标记和推送的图像中的文件不同。 ECR实际上没有更新的原因是什么?如果您有关于我应该尝试的事情的提示,请在评论中提供。