Skip to content Skip to sidebar Skip to footer

Docker Not Saving File On Keyboardinterrupt

I'm storing tweets into a CSV, when I run the following code in Jupyter Notebook it'll save to tweets.csv successfully. with open(fName, 'a') as f: while True: try: if

Solution 1:

From your docker command , it seems that you are not mounting your local directory to your docker container. Docker containers have a different filesystem from the host and files saved in docker containers are get lost once the container is removed. To fix this, run your command like this:

docker run  -v /User/Seth/some/local/directory:/app/ dock

This commands binds your local directory that you defined before the : to the directory app inside the docker container. You should check that the local directory exists, and it should be the absolute path. As your docker container runs in /app,it will download the tweets.csv there and you should be able to see it in your /some/local/directory after it is completed. You might also see your whole codebase as you are downloading the file to the same directory with your code.

Here is the link for Docker volumes


*Just for completeness, this has nothing to do with keyboard interrupt.

Post a Comment for "Docker Not Saving File On Keyboardinterrupt"