Answers: <p>You could run the container with its root file system as read only:</p>
  <p><code>docker run --read-only</code></p>
  <p>and then ensure that a rw docker volume or tmpfs is mounted at each location the container process tries to write.</p>
  <p>Depending on how well tested the app is for running in a ro filesystem, this may or may not work as expected.</p>
  
Answers: CC BY-SA 4.0
Answers: 2023-06-15T07:36:02.067Z
Answers: 2023-06-15T07:36:02.067Z
Answers: Chris Becke
Body: <p>I have an extracted container deployed on a shared storage, and want to launch this container locally. However, when I launch this container to run an application, it creates some temporary files inside the container. I do not want to write anything inside the container and want these files to be generated locally (since it may create overhead on the shared storage). How can this be done?  Thanks</p>
  
Tags: <docker><dockerfile>
Title: Prevent docker to write inside container
UserDisplayName: Sandy
ThreadText: # Prevent docker to write inside container
  
  (Asked by: username_0 on 2023-06-14)
  
  I have an extracted container deployed on a shared storage, and want to launch this container locally. However, when I launch this container to run an application, it creates some temporary files inside the container. I do not want to write anything inside the container and want these files to be generated locally (since it may create overhead on the shared storage). How can this be done? Thanks
  
  **Tags:** docker, dockerfile
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-06-15. Score: 1
  
  You could run the container with its root file system as read only:
  
  `docker run --read-only`
  
  and then ensure that a rw docker volume or tmpfs is mounted at each location the container process tries to write.
  
  Depending on how well tested the app is for running in a ro filesystem, this may or may not work as expected.
  
  
  ---
  
  