Docker cp works perfectly fine when we are inside the directory whose contents we need to copy in bulk into the container. Apparently, the asterisk wildcard (*) is not supported for copying multiple files with docker cp command.
Copied the contents not the directory.
Also, given is the docker version for reference. Although, not much changes to the docker cp until lately from this post.
[root@stnm001 hadoop-configs]# docker version
Client:
Version: 1.12.3
API version: 1.24
Go version: go1.6.3
Git commit: 6b644ec
Built:
OS/Arch: linux/amd64
Server:
Version: 1.12.3
API version: 1.24
Go version: go1.6.3
Git commit: 6b644ec
Built:
OS/Arch: linux/amd64
[root@stnm001 hadoop-configs]#
[root@stnm001 hadoop-configs]# docker cp ./ "xyz-downloader:/etc/hadoop/conf"
[root@stnm001 hadoop-configs]#
[root@stnm001 hadoop-configs]# ls
capacity-scheduler.xml container-executor.cfg dfs.exclude hadoop-metrics2.properties hadoop-policy.xml hdfs-site.xml slaves ssl-server.xml yarn.exclude
configuration.xsl core-site.xml hadoop-env.sh hadoop-metrics.properties hbase-site.xml log4j.properties ssl-client.xml yarn-env.sh yarn-site.xml
[root@stnm001 hadoop-configs]#
[root@stnm001 hadoop-configs]#
[root@stnm001 hadoop-configs]# docker exec -it xyz-downloader bash
[root@xyz-downloader /]#
[root@xyz-downloader /]#
[root@xyz-downloader /]# cd /etc/hadoop/conf/
[root@xyz-downloader conf]# ls -ltrh
total 100K
-rw-r--r-- 1 root root 318 May 20 06:57 container-executor.cfg
-rw-r--r-- 1 root root 1.4K May 20 06:57 configuration.xsl
-rw-r--r-- 1 root root 3.6K May 20 06:57 capacity-scheduler.xml
-rw-r--r-- 1 root root 1.8K May 20 06:57 hadoop-metrics2.properties
-rw-r--r-- 1 root root 3.6K May 20 06:57 hadoop-env.sh
-rw-r--r-- 1 root root 0 May 20 06:57 dfs.exclude
-rw-r--r-- 1 root root 1.4K May 20 06:57 core-site.xml
-rw-r--r-- 1 root root 5.2K May 20 06:57 hdfs-site.xml
-rw-r--r-- 1 root root 9.1K May 20 06:57 hadoop-policy.xml
-rw-r--r-- 1 root root 2.5K May 20 06:57 hadoop-metrics.properties
-rw-r--r-- 1 root root 891 May 20 06:57 ssl-client.xml
-rw-r--r-- 1 root root 102 May 20 06:57 slaves
-rw-r--r-- 1 root root 15K May 20 06:57 log4j.properties
-rw-r--r-- 1 root root 4.7K May 20 06:57 yarn-env.sh
-rw-r--r-- 1 root root 891 May 20 06:57 ssl-server.xml
-rw-r--r-- 1 root root 11K May 20 06:57 yarn-site.xml
-rw-r--r-- 1 root root 0 May 20 06:57 yarn.exclude
-rw-r--r-- 1 root root 2.7K May 20 06:58 hbase-site.xml
[root@xyz-downloader conf]#