How to copy files from dockerfile to hosting?

I want to get some files when dockerfile is created successfully, but it does not copy files from the container to the host.

This means that when I created the docker file, the files are already nodes.

+4
source share
1 answer

When you create, you have the option to copy files from the host to the image you create (with COPYor directive ADD)

You can also copy files from the container (the image that was docker run' d) to the host with docker cp (usually, cp can also copy from the host to the container)

" Docker": Docker - , , .

, (, script ssl), , cp.

. , getcrt script.

docker run -u root --entrypoint=/bin/sh --rm -i -v ${HOME}/b2d/apache:/apache apache << COMMANDS
pwd
cp crt /apache
cp key /apache
echo Changing owner from \$(id -u):\$(id -g) to $(id -u):$(id -u)
chown -R $(id -u):$(id -u) /apache/crt
chown -R $(id -u):$(id -u) /apache/key
COMMANDS

COMMANDS - , , cp , ${HOME}/b2d/apache, /apache -v ${HOME}/b2d/apache:/apache.

, , - /apache , ${HOME}/b2d/apache !

+2

Source: https://habr.com/ru/post/1613403/