You don’t have to stop your docker containers or rebuild your images to transfer or update data. There are better ways!
In my latest article, I share three effective methods:
-
docker cp
Command:- Allows you to copy files or directories between the host and the container, even after the container has started.
- Example:
docker cp ./file.csv my-container:/path
-
Bind Mounts:
- Mount a directory from the host directly into the container. Changes are instantly reflected in both directions.
- Example:
docker run -v ./local-folder:/container-path ...
-
Direct download with
wget
orcurl
:- Ideal for downloading files directly from the internet into the container.
- Example:
docker exec -it my-container wget "url-to/file.csv" -O /path/file.csv
These techniques will allow you to manage your file transfers more flexibly, making your Docker workflow more efficient.
To learn more and practice these methods, read the full article
Enjoy!