Recently, I had to recall how to update the license for the Business Central On-Premise setup and figured that I could do it in my Business Central docker instance instead. Then I realized I do not have a file management interface like Windows Explorer available for me to perform file transfers. Admittedly I’m still a novice in using Docker but luckily there’s Google!
The easiest way is to use the “docker cp” command. This command allows you to move files to and fro a docker container. An important point to note is that while you can always extract files from the container, you will need to stop the instance first before putting something in.
To insert a file into the container, the syntax and example are:
docker cp <source file path in host machine> <container name>:<destination file path in container>
Example:
My source file path is “C:\MyFolder\newlicense.flf”
My Docker Container is “BCDevDocker”
My destination file path is “C:\MyFiles\licensedocker.flf”
docker cp "\MyFolder\newlicense.flf" "BCDevDocker:\MyFiles\licensedocker.flf"
To copy a file from the container to your host machine, just reverse the parameters. The syntax and example are:
docker cp <source container name>:<source file path in container> <destination file path in host machine>
Example:
My source file path in Container is “C:\MyFiles\licensedocker.flf”
My Docker Container is “BCDevDocker”
My destination file path is “C:\MyFolder\newlicense.flf”
docker cp "BCDevDocker:\MyFiles\licensedocker.flf" "\MyFolder\newlicense.flf"
If the destination has a file with the same name, it will be overwritten.