The best way to do this is probably via docker volumes. For dokku, check out dokku-persistent-storage
But here's a quick hack using netcat anyway.
Assuming we've found the container ID (e.g.: via docker ps
):
$ CID=f7a29d6dc8e4
Get the IP address of the container:
$ CIP=`docker inspect -format '{{ .NetworkSettings.IPAddress }}' ${CID}`
Specific the local path and destination path:
$ LN=db/seeds/local.file.txt
$ DN=db/seeds/remote.file.txt
In the docker container, netcat
listens:
$ echo "nc -l 1234 > $DN" | docker attach $CID
Meanwhile, on the host, netcat
sends:
$ nc $CIP 1234 < $LN
You won't see any output of docker attach
. But, if you're already attached in another window, you can monitor the progress. Or, while you run the commands, you could probably tail a log of the container with docker logs -f $CID
.
REFERENCES