Docker cp Command

Docker cp Command

docker cp : for data copy between container and host.

Docker cp Syntax

docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-
docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH

OPTIONS Description.

  • -L : Keep the link in the source target

Docker cp Example

Copy the host /www/apidemos directory to the /www directory of container 96f7f14e99ab.

docker cp /www/apidemos 96f7f14e99ab:/www/

Copy the host/www/apidemos directory to the container 96f7f14e99ab and rename the directory to www.

docker cp /www/apidemos 96f7f14e99ab:/www

Copy the /www directory of container 96f7f14e99ab to the /tmp directory of the host.

docker cp  96f7f14e99ab:/www /tmp/
Like(0)