Docker – SCP from docker image on elastic beanstalk

dockerelastic-beanstalk

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.

Best Answer

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.