6 ms·
> making it easy to use for every day development Can you elaborate here? I've started using Docker for development recently (pretty much just to avoid local m
by jypepin 9y ago
> making it easy to use for every day development
Can you elaborate here? I've started using Docker for development recently (pretty much just to avoid local mySQL troubles in a Rails project) - we use a docker-compose file to start an official mySQL image and the local rails repo.
Seemed easy enough, until I realized I have to restart my container every time my code changed. Then I had to integrate docker-sync, which is a great library but not official. I'm still surprised code sync is not included out of the box from Docker yet - am I missing something?
- drodgers 9y agoYes. Volumes: https://docs.docker.com/engine/admin/volumes/volumes/ https://docs.docker.com/engine/admin/volumes/volumes/ Mount a directory from your local filesystem as a volume and file changes within that directory will appear immediately in the container.
- fpoling 9y agoThis even works when one uses docker build to compile things. Just have a shell script that after the build copies the compilation result to a local directory mounted as a volume in the docker container.
- cdancette 9y agoWhy not compile inside the volume already?
- fpoling 9y agoThis is what I have used before docker build started to support multiple images. That is, I had a shell script that run an image with a compiler that put the executable to a local directory. Then normal docker build would pickup the executable into the final image. But this does not take advantage of caching with docker build and made the infrastructure more complex. Dockerfile with multiple images addressed that nicely. Now single docker build command takes care about everything and generates production ready images. A shell script is only necessary during development to extract some files from the image to avoid restarting already running container.
- jypepin 9y agomy understanding is that volumes are more for persisting data on your host's filesystem, right? I'm talking more about having code you write automatically sync'ed inside the container - do volumes offer that?
- luhn 9y agoCode reload in a container has always been pretty painful. I don’t use Docker for the application I’m developing on, relying on virtualenv (in your case RVM) to keep a clean, stable, and contained environment. I use Docker for the dependencies (which is a huge boon) and when I’m done developing, I package the app into a Docker container so I can easily distribute it.
- oblio 9y agoWhy is code reload painful? Just mount a volume from the code you're editing in the host.
- kitten_mittens_ 9y agoIf you’re using Docker on Windows, bind mount propagation isn’t a thing. Adding a new file (or maybe a folder) on the host machine means you have to restart docker. This is especially bad in node development when you are trying to work on your npm dependencies.
- cweagans 9y agoAre you sure your information is up to date? 'Cause I'm pretty sure that's not an issue anymore.
- LoSboccacc 9y agoJust a heads up to save you time down the road: Docker works well for small deployments and extremely large deployment, it is extremely mismatched in bringing your average three tier app into medium size cluster because swarm doesn’t do routing well for that and because the underlying assumption is that each service is perfectly identical across each node - so even having a cluster id to ddcide who’s master in a nosql development is extra weird.
- Terr_ 9y agoAs others have already mentioned shared volumes, here's a commented little command-line demo of the principle: https://github.com/DHager/docker-php-library-demo https://github.com/DHager/docker-php-library-demo It should be easy enough achieve the same results with your docker-compose configuration.