0

For example:-

Environment:- A nginx docker container running on ecs cluster Now I have file by the name my.cnf in the docker container

Location:- /home/bakul/my.cnf

What I want?

Basically, I am interested in copying this file i.e(/home/bakul/my.cnf) into the host machine (ecs instance).

Problem:- When I tried to define the task definition then I use

Volume:- /home/ec2-user/test/my.cnf (Host machine path)

For container, I used the mount point as:- /home/bakul/my.cnf

When I run the task definitions, instead of mounting the file, it creates the directory in the host machine.

References Used:-

https://docs.docker.com/storage/#good-use-cases-for-bind-mounts https://docs.aws.amazon.com/AmazonECS/latest/developerguide/example_task_definitions.html

Bakul Gupta
  • 103
  • 1
  • 5
  • Can you explain why you want to copy the file onto the host machine? – Rob Lockwood-Blake Aug 23 '18 at 17:02
  • Possible duplicate of [Copying files from Docker container to host](https://stackoverflow.com/questions/22049212/copying-files-from-docker-container-to-host) – David Maze Aug 23 '18 at 20:32
  • Why I want to copy the files? In order to make the data persistent ,wen i tried to mount a file to host system,then instead of file creation it creates the directory – Bakul Gupta Aug 23 '18 at 23:55
  • No it is not the duplicate question :- Because here I want to copy the file from the container defined into the ECS cluster (AWS service).Yeah i can run the docker cp command ,but i need to define some methodology into the task definition itself,because my ecs cluster contains lot of containers,it will be mereley impossible to copt the files manually into the host ec2 machine from the docker cp command – Bakul Gupta Aug 23 '18 at 23:58
  • Hi, did you find the solution here? I also met an issue to mount volume from container into ECS EC2 Instance.. – suanziliu Sep 19 '19 at 09:43

0 Answers0