Reputation: 2492
I have a Dockerfile in which I compile something. I want to put the binary executable back to a host's directory.
Note. I know this can be done by docker cp <container ID>:path host_path
, but that is NOT what I am asking about.
I want to add COPY
command in the Dockerfile so it does that automatically. Is it possible?
Upvotes: 1
Views: 153
Reputation: 74871
Docker's build process does not provide the functionality to copy files out of an image without using an intermediate step. This would need something external to manage the build workflow with additional steps like docker cp
as you suggested.
Rocker may be of interest which implements it's own build system via the Docker API with an extended set of Dockers build commands. A number of the useful features that users have requested and Docker refused to add have been added here.
Features includes MOUNT
ing volumes from the host during the build. EXPORT
/IMPORT
of files from a build. Multiple FROM
s, one for the "build" container, and another for the "run" container.
Upvotes: 1