I have a script that makes a directory inside a docker container and copies a file from the host to the new directory.
# $wpc is a variable holding the container name
#make the directory in the container
docker exec $wpc bash -c "mkdir -p /root/.ssh"
#stop container
docker stop $wpc
#copy file to container
docker cp ~/.ssh/id_rsa $wpc:/root/.ssh/id_rsa
# wait until the wordpress container is running
docker start $wpc
but I get this error:
Error: No such container:path: <container_name>:\root\.ssh
Is the syntax wrong? I tried changing the permissions for the folder before the file is copied, with no luck.
I'm running docker on windows server 2019 and My Docker Info:
Client: Docker Engine - Enterprise
Version: 19.03.5
API version: 1.40
Go version: go1.12.12
Git commit: 2ee0c57608
Built: 11/13/2019 08:00:16
OS/Arch: windows/amd64
Experimental: true
Server: Docker Engine - Enterprise
Engine:
Version: 19.03.5
API version: 1.40 (minimum version 1.24)
Go version: go1.12.12
Git commit: 2ee0c57608
Built: 11/13/2019 07:58:51
OS/Arch: windows/amd64
Experimental: true
Any help or info appreciated.