Google News
logo
Docker - Interview Questions
Is there a possibility to include a specific code with COPY/ADD or a volume?
This can be easily achieved by adding either the COPY or the ADD directives in your docker file. This will count to be useful if you want to move your code along with any of your Docker images, for example, sending your code an environment up the ladder – The development environment to the Staging environment or from the Staging environment to the Production environment. 
 
Having said that, you might come across situations where you’ll need to use both approaches. You can have the image include the code using a COPY, and use a volume in your Compose file to include the code from the host during development. The volume overrides the directory contents of the image.
Advertisement