Mounting a Volume Using Compose and Sharing Images
Discover how to mount local directories as volumes in Docker Compose to sync Rails app files for real-time development without restarting the server. Understand how to share and manage custom Docker images using DockerHub to speed up the build process and collaborate effectively.
We'll cover the following...
Mounting a volume
Before we leave our docker-compose.yml, let’s make a small addition. The -v option allows us to mount a local directory inside a container with docker run. By using this, the Rails project files generated inside the container would be available on our local machine. A mounted local volume represents some filesystem that is shared between your local machine and the container. Files in the mounted volume have synced both ways between your local filesystem and the container.
Because of this, a local volume mount can allow us to develop ...