Aromadz
Aromadz

Reputation: 173

how to add s3 files to docker image

I am a newbie to docker. I am trying to deploy a R app as a docker image. I am able to deploy the app in docker by mounting the folder. But I don't think that is going to work in AWS. I am thinking of storing my app in s3 and adding it during the build by ADD command. But it is throwing me this error : ADD failed: stat /var/lib/docker/tmp/docker-builder441270805/s3:/bucket_name/app: no such file or directory

Can you guys please give me any idea on how to do it ? Thanks

Upvotes: 6

Views: 7757

Answers (1)

Rick van Lieshout
Rick van Lieshout

Reputation: 2316

This doesn't work because /var/lib/docker/tmp/docker-builder441270805/s3:/bucket_name/app is not a valid path, docker simply can't find anything there.

Possible solutions:

  1. mount the s3 folder to a local folder and use that instead.
  2. Make the bucket publically available and download the app in the Dockerfile using curl/wget or whatever.

Option 1 has the advantage of having to change very little to your current workflow while option 2 would allow anyone with access to the bucket to be able to build the dockerfile without having to do anything to the underlying os / file structure.

Note downloading the files from s3 might not always work, the docker cache is rather aggressive and may cause issues when you want the updated output to make it into a new container.

For more info see this blog post.

Upvotes: 2

Related Questions