sleep commands won’t help, the SSH feature (which you already tried since then) is to way to debug and it can stop the execution after a job.
You are using sudo befoe the docker client command, but even without sudo the daemon is probably running as root and that is what matters. Even when you have permission issues for some reason, there should be an error message, not an empty folder in the container.
Now I start to remember how Docker runs on CircleCI. I implemented my custom builder called “local-builder” because I wanted Docker to work the same way locally as on CircleCI, so I ran my container to run the Docker client inside a container.
On the other hand, I used a variable COPY_MODE
to decide whether I wanted to copy the files or mount them. I think the problem is that CircleCI has a remote Docker daemon, and when you are using a remote Docker, you can’t mount a local folder to the remote server. So if you need the files, you probably need to copy them.
CircleCI supports different kind of infrastructures to build (execution environment). You can have a virtual machine, or a container as well. The documentation of the Docker execution environment mentions limitations:
For example not being able to use volumes. I believe they mean bind mounts which is under the volumes section in the compose file. That would make more sense.
Or you can ask for a vitual machine:
With that you would have full controll, and you could install Docker locally, but it would take more time to build docker images as you would have to wait for the virtual machine too.
I tried both ways and I felt using the Docker execution environment and copying files into my build container was a better way, but I recommend you to try and decide what is the best for you.