COPY inside your Dockerfile actually copies the files to the given path. Imagine this being carved in ice. Like once you copy everything, unless you re-build your image the files cannot be modified from outside. Where as the volume is actually creating a mounting point to the host. So if you are doing development where you need to change the code, and you use COPY you have to re-build the image everytime you want to have your changes to be in the container, whereas with volume you do not have to do rebuild your image the changes will be transfered to the container.
Use volumes during development or if you have anything you want to have a persistance, like databases and such. If you do not volume mount your database, whenever you restart your container data will be lost.
Use COPY when you are ready to ship the application and you are sure you do not modify the source code anymore.
For further reading please look at this : Docker ADD vs COPY vs VOLUME
I hope this answers your question.
- Why do not use volumes instead of copy in the docker-compose?
- babel 7 Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead
- If 'React' is the default export from 'react', Why can't we use some other name instead of 'React'
- Why does jest-dom give the error "TypeError: expect(...).not.toBeVisible is not a function" when I use it
- Why can I not use a variable as parameter in the require() function of node.js (browserify)?
- Why do Material UI tabs stop working when I use a .map to populate the content dynamically instead of hard coding?
- React: Why not just use styles object instead of styled-components?
- Webpack does not copy the images that i use into react components
- Not able to figure out why docker compose up is not running my React JS App
- Not clear why the use effect hook gets triggered too many times
- Learning React: why do we not have to use this.state.count in line 18 to access the count but we have to use this.state.imageUrl in line 12?
- Why is placing an html5 canvas over a video not covering the video, instead the canvas shows no colored background, video freezes to a single frame
- Docker Compose with Docker Toolbox: Node, Mongo, React. React app not showing in the said adress
- Why people use style on React direct to the file on File.js? Why not just on index.html?
- why i am not able to use the default theme properties in makeStyle?
- why is that the simple use of setState method not working in the componentDidMount() method
- why my useReducer function is not working.when I use it The page show but function is not working
- Why does calling react setState method not mutate the state immediately?
- Objects are not valid as a React child. If you meant to render a collection of children, use an array instead
- Why is the `MouseEvent` in the checkbox event handler not generic?
- Warning: Use the 'defaultValue' or 'value' props on <select> instead of setting 'selected' on <option>
- Why do the React docs recommend doing AJAX in componentDidMount, not componentWillMount?
- Why is `Promise.then` called twice in a React component but not the console.log?
- Why is console.log() showing react_devtools_backend.js:4049 instead of the file and line number?
- Why use getDerivedStateFromProps instead of componentDidUpdate?
- Warning: You should not use <Route component> and <Route render> in the same route; <Route render> will be ignored
- How to use react-router 4.0 to refresh current route? not reload the whole page
- Material-UI - Why should I use makeStyles instead of inline styles?
- Could not find a required file. Name: index.html in react with docker compose
More Query from same tag
- Why "gulp-jest" is failing with: "Please run node with the --harmony flag!"?
- Breaking an array items into certain number of rows
- Msal logout displaying multiple account
- Add a conditional error and success message on a panel based on required input fields are filled or not. If all fields are filled,"Done" should did
- Wraparound in the React js
- React props are not working into for loop
- fuction not returning a list of radio button Reactjs- ReactBootstrap
- React router is taking me to the same page
- React file viewer not working with firebase storage links
- React Native: ReferenceError: Can't find variable: require (line 1 in the generated bundle)
- Implicit return in arrow function
- Jest setupTestFrameworkScriptFile or setupFiles ES6 syntax
- concatenation state in useEffect cause loop
- Mongoose does not send the updated result
- react-bootstrap-table: Programmatically filter by clicking from another component
- Why doesn't 100vh fill whole page?
- Can GraphQL query a third party API?
- Material UI TreeView: Display multiple columns data from node in treeview
- Typescript IndexOf Issue in Array<String> useState
- ReactJS change color of the selected option in a select option control
- useState not registering on first render
- I have two components. I want to call 1st component into the second component. How can I do it?
- Uncaught TypeError: Cannot read properties of undefined (reading 'image') BookingCar.js
- Element implicitly has an 'any' type because expression of type 'string | number' can't be used to index type
- How can I get list of all types from graphql schema?
- In Relay, what role do the node interface and the global ID spec play?
- Is there any alternative to CORS google chrome extension? How to make successful ajax request without using CORS?
- How to destroy root Preact node?
- React JS - How to update image only once loaded?
- Specifically defining hashHistory and yet --- Cannot read property 'getCurrentLocation' of undefined(…)