AWS Docker部署失败并显示以下错误:未知速记标志:-e中的'e'并且没有基本身份验证凭证

时间:2018-12-20 09:23:28

标签: amazon-web-services docker amazon-ec2

我尝试使用AWS Codepipeline将docker容器部署到AWS EC2。

我得到以下两个错误:

Container] 2018/12/19 16:42:43 Running command chmod +x buildspec_prebuild.sh && ./buildspec_prebuild.sh
----------- AWS ECR Login -----------
unknown shorthand flag: 'e' in -e
See 'docker login --help'.
{
 "failures": [
 {
 "failureCode": "ImageNotFound",
 "failureReason": "Requested image not found",
 "imageId": {
 "imageTag": "submissionmanager-backend"
 }
 }
 ],
 "imageIds": []
}

我认为出现以下错误是这样的:

no basic auth credentials

我的文件如下:

buildspec_build.sh

#!/bin/bash

# make code ready for docker
sbt docker:stage
cd target/docker/stage

# add port for aws to dockerfile
echo "EXPOSE 9000" >> Dockerfile

# generate docker image tag
docker build -t "$(cat /tmp/build_tag.out)" .

buildspec_install.sh

#!/bin/bash
apt-get update

# install jdk
apt-get -y install software-properties-common
apt-get -y install -y python-software-properties debconf-utils
add-apt-repository -y ppa:openjdk-r/ppa
apt-get update
apt-get -y install openjdk-8-jdk
update-alternatives --config java
update-alternatives --config javac

sudo update-ca-certificates -f
sudo /var/lib/dpkg/info/ca-certificates-java.postinst configure

echo "java installation ok"

# install sbt
echo "starting sbt installation"

apt-get install -y apt-transport-https
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823

# install python & pip
echo "Installing python & pip"
apt-get install -y python3-pip

apt-get update
apt-get install -y sbt
echo "sbt installation ok"

pip3 install --upgrade awscli

buildspec_postbuild.sh

#!/bin/bash

# push docker image to aws ec2 container repository
docker push "$(cat /tmp/build_tag.out)"

buildspec_prebuild.sh

#!/bin/bash
printf "%s:%s" "$REPOSITORY_URI" "$IMAGE_TAG" > /tmp/build_tag.out
echo "----------- AWS ECR Login -----------"
$(aws ecr get-login)

#$(aws ecr get-login | sed 's|https://||')

# delete old docker image
aws ecr batch-delete-image --repository-name $REPOSITORY_NAME --image-ids imageTag=$IMAGE_TAG

在这种情况下我可能会遇到什么问题?

谢谢。

0 个答案:

没有答案