In this build I have a docker-compose setup that I’m trying to test. In short I want to be able to run a docker compse up, run composer, and do a quick database install.
I get to the composer install step docker-compose run php composer install and get an error message saying no composer.json is there. Running docker-compose run php ls /var/www/html reveals an empty dir. I’m a bit at a loss how this is working because in my latest build I’m running the actual --build flags and can see the output where I have my COPY commands.
The problem is that, by virtue of the CircleCI architecture, you cannot use on-host volumes. They only work locally, but CircleCI hooks into Docker to spin up containers on remote boxes, and volumes don’t work over LAN connections.
There’s a solution involving docker create in the link you have given. Or, the way I do it, is to bake a new Docker image with everything it needs, and run that. That makes sense for me anyway, since I need the image artefact for deployment.
But that’s the thing, I AM building an image, in my docker compose I use the build: ./ key, and I can see my COPY ./ /var/www/html command running in the output. What additional steps would I need to take to build these files into my image? If I run the new image locally and just use docker run I can create a container from my new image, with the applications web dir on there?
I appreciate the hlep, I’m just still not understanding why my files are not there, after I have built using the dockerfile included.
There’s a few of these, and if you don’t need the volumes, I wonder if you need to take them out. I wonder if this would effectively overwrite the files in the container with an (apparently empty) folder that has failed to mount.