How to resolve "failed to create containerd task: failed to create shim: OCI runtime create failed: invalid mount" error?

Viewed 6681

I am building a website written using the framework Angular 9 and for deploying the website it is required to do CI/CD using Bitbucket Pipelines. Currently, I am making a dist folder, then uploading this folder into an AWS S3 bucket and publish it as a website. Every time I make a tiny change in any file, I delete the dist folder from the bucket and upload the new folder. All this should work from Bitbucket Pipelines yml file. Here is my bitbucket-pipelines yml file.

image: cgswong/aws:aws

pipelines:
  branches:
    master:
      - step:
          script:
            - aws s3 --region "ap-southeast-1" sync --delete dist/xyz s3://xyz.abc.com
    staging:
      - step:
          script:
            - aws s3 --region "ap-southeast-1" sync --delete dist/xyz s3://stage.xyz.abc.com

Every time, when I try to deploy the site, It gives me the following error

failed to create containerd task: failed to create shim: OCI runtime create failed: invalid mount {Destination:~/.aws Type:bind Source:/var/lib/containerd/io.containerd.grpc.v1.cri/containers/4161c400375792a5ad88ec1cf1a89da50ae93ad532e4e490fe94d6c978f2de0f/volumes/0608fb757b1b423a3d52e795531d103a5d8ca6ebcd74c35158f6cbb29890571a Options:[rbind rprivate rw]}: mount destination ~/.aws not absolute: unknown

I am new to CI/CD. What can be done to resolve this problem?

2 Answers

I've found the solution. I edited docker image from 'image: cgswong/aws' to official one 'image: amazon/aws-cli:2.0.6' and it started working.

It looks like your base image has some problems. Probably it doesn't contain your AWS creds in ~/.aws location. Can you verify this image contains your creds ?

In the image's dockerhub READme, it's said that there is 3 ways to attach creds to image, if all your work is written here, I couldn't see any of them.

Document : https://hub.docker.com/r/cgswong/aws

Related