Trying to get the ECR push pipe to work but we seem to be facing an issue.
The following does work:
- docker build -t open-api .
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
- docker tag open-api:latest $AWS_ACCOUNT.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/open-api:${BITBUCKET_COMMIT:0:7}-$(date +"%d%m%Y-%H%M%S")
- docker push $AWS_ACCOUNT.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/open-api:${BITBUCKET_COMMIT:0:7}-$(date +"%d%m%Y-%H%M%S")
- docker build -t open-api .
- pipe: atlassian/aws-ecr-push-image:2.0.0
variables:
IMAGE_NAME: open-api
DEBUG: 'true'
TAGS: ${BITBUCKET_COMMIT:0:7}-$(date +"%d%m%Y-%H%M%S")
From looking at the py script is seems like the docker login function is hanging. We can't understand why as is logs on fine when we used the aws sdk.
Error message:
INFO: Using default authentication with AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEYDEBUG: Starting new HTTPS connection (1): bitbucket.org:443DEBUG: https://bitbucket.org:443 "GET /bitbucketpipelines/official-pipes/raw/master/pipes.prod.json HTTP/1.1" 200 NoneINFO: Executing the aws-ecr-push-image pipe...DEBUG: Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']DEBUG: No config file foundDEBUG: Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']DEBUG: No config file foundDEBUG: Starting new HTTP connection (1): host.docker.internal:2375Traceback (most recent call last):File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 174, in _new_connconn = connection.create_connection(File "/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py", line 95, in create_connectionraise errFile "/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py", line 85, in create_connectionsock.connect(sa)TimeoutError: timed outDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopenhttplib_response = self._make_request(File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 398, in _make_requestconn.request(method, url, **httplib_request_kw)File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 239, in requestsuper(HTTPConnection, self).request(method, url, body=body, headers=headers)File "/usr/local/lib/python3.10/http/client.py", line 1282, in requestself._send_request(method, url, body, headers, encode_chunked)File "/usr/local/lib/python3.10/http/client.py", line 1328, in _send_requestself.endheaders(body, encode_chunked=encode_chunked)File "/usr/local/lib/python3.10/http/client.py", line 1277, in endheadersself._send_output(message_body, encode_chunked=encode_chunked)File "/usr/local/lib/python3.10/http/client.py", line 1037, in _send_outputself.send(msg)File "/usr/local/lib/python3.10/http/client.py", line 975, in sendself.connect()File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 205, in connectconn = self._new_conn()File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 179, in _new_connraise ConnectTimeoutError(urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPConnection object at 0x7f03b0595780>, 'Connection to host.docker.internal timed out. (connect timeout=60)')During handling of the above exception, another exception occurred:Traceback (most recent call last):File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in sendresp = conn.urlopen(File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopenretries = retries.increment(File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in incrementraise MaxRetryError(_pool, url, error or ResponseError(cause))urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='host.docker.internal', port=2375): Max retries exceeded with url: /version (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f03b0595780>, 'Connection to host.docker.internal timed out. (connect timeout=60)'))During handling of the above exception, another exception occurred:Traceback (most recent call last):File "/usr/local/lib/python3.10/site-packages/docker/api/client.py", line 214, in _retrieve_server_versionreturn self.version(api_version=False)["ApiVersion"]File "/usr/local/lib/python3.10/site-packages/docker/api/daemon.py", line 181, in versionreturn self._result(self._get(url), json=True)File "/usr/local/lib/python3.10/site-packages/docker/utils/decorators.py", line 46, in innerreturn f(self, *args, **kwargs)File "/usr/local/lib/python3.10/site-packages/docker/api/client.py", line 237, in _getreturn self.get(url, **self._set_request_timeout(kwargs))File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 600, in getreturn self.request("GET", url, **kwargs)File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in requestresp = self.send(prep, **send_kwargs)File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in sendr = adapter.send(request, **kwargs)File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 553, in sendraise ConnectTimeout(e, request=request)requests.exceptions.ConnectTimeout: HTTPConnectionPool(host='host.docker.internal', port=2375): Max retries exceeded with url: /version (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f03b0595780>, 'Connection to host.docker.internal timed out. (connect timeout=60)'))During handling of the above exception, another exception occurred:Traceback (most recent call last):File "/pipe.py", line 273, in <module>pipe.run()File "/pipe.py", line 242, in rundocker_client = self.get_docker_client()File "/pipe.py", line 166, in get_docker_clientself.docker_client = docker.from_env()File "/usr/local/lib/python3.10/site-packages/docker/client.py", line 96, in from_envreturn cls(File "/usr/local/lib/python3.10/site-packages/docker/client.py", line 45, in __init__self.api = APIClient(*args, **kwargs)File "/usr/local/lib/python3.10/site-packages/docker/api/client.py", line 197, in __init__self._version = self._retrieve_server_version()File "/usr/local/lib/python3.10/site-packages/docker/api/client.py", line 221, in _retrieve_server_versionraise DockerException(docker.errors.DockerException: Error while fetching server API version: HTTPConnectionPool(host='host.docker.internal', port=2375): Max retries exceeded with url: /version (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f03b0595780>, 'Connection to host.docker.internal timed out. (connect timeout=60)'))I'm also facing this issue, even though there's enough environment variables that pipe requires.
Thank you for your question!
In the example you provided,
- docker build -t open-api .
- pipe: atlassian/aws-ecr-push-image:2.0.0
variables:
IMAGE_NAME: open-api
DEBUG: 'true'
TAGS: ${BITBUCKET_COMMIT:0:7}-$(date +"%d%m%Y-%H%M%S")
make sure you tag docker image with the tag
open-api:${BITBUCKET_COMMIT:0:7}-$(date +"%d%m%Y-%H%M%S")
before you use the pipe.
Best regards,
Oleksandr Kyrdan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try using the following login command:
- aws ecr get-login-password --region $AWS_DEFAULT_REGION |
docker login --username AWS --password-stdin
$AWS_ACCOUNT.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/open-api
Note the repo-name at the end of the ecr url.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This command works. It's when I do the same thing with the pipe that it does not.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.