0

I need to get a file from the docker image running on AWS Elastic Beanstalk.

I can SSH into the EB instance, but after that I have no idea what to do.

sudo docker images shows two images, one with my app name and the other called aws-beanstalk/current-app.

Synesso
  • 209
  • 1
  • 4
  • 14
  • 1
    You can't use `docker exec` on an image, it is used to run a command in a running container. – Daniel t. May 06 '15 at 02:09
  • Thanks. https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcTTjAmb2ScdNRBXb7g3bJyzFo9SM2CESQ7DpeXo2uq4eG3GRwhXfw – Synesso May 06 '15 at 02:12

1 Answers1

1

One way of copying a file would be to do it from the container. If you have a running container, use docker cp to transfer the file to your host, in this case the EB instnace.

Run docker ps to get the container ID. If you don't see any output, launch a container based on the image you are interested in. Say, if your image name is 'aws-beanstalk/current-app' -

docker run -ti --rm aws-beanstalk/current-app /bin/bash

Then from the docker host, for instance to transfer a file under /code/run.py on the container to /tmp on the host:

docker cp containerID:/code/run.py /tmp

The containerID is the one you see after running docker ps

You can also use docker exec -ti containerID /bin/bash to interactively work on an already running container.

Daniel t.
  • 9,291
  • 1
  • 33
  • 36
  • The docker cp command didn't understand wildcards, but copying a file at a time worked. Thanks. – Synesso May 06 '15 at 03:18