Tuesday, 9 January 2018

Copying a file from a Docker container to the host

Often things are more convoluted than you expect. Sometimes they are easier than you fear.

Here's an example: you're generating files inside a Docker container (with no volumes configured) and you realise you need some of those files available in the host.

A simple solution is to use 'docker cp', with a format like

docker cp CONTAINER_ID:FILE_PATH HOST_FILE_PATH

Official documentation.
A Stackoverflow question with more discussions.

No comments:

Post a Comment

It's not a sprint

You’ve surely heard at least once in your life somebody saying “Calm down: it’s not a sprint, it’s a marathon”. People use this phrase to tr...