It is currently not possible to run texd in container mode, while texd itself is running containerized:
$ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
digineode/texd texlive/texlive:latest
This will start the texd container just fine, but fails to execute any jobs, because the job directory (/texd) only exists within the texd container and texd tries to mount it in a new container.
executing jobs still fails, because texd basically tries to run the following command:
$ docker run --rm -v /texd/job-1234:/texd texlive/texlive:latest latexmk ...
Docker commands however are run on the Docker host, and the name of the job directory is $(pwd)/jobs/job-1234, not /texd/job-1234.
I believe, a simple rewrite mechanism for the job directory when starting job containers should suffice. Detecting whether texd runs Docker-in-Docker is a bit harder, but still doable. Given the container ID (found in /proc/1/cpuset), we can simply ask the docker daemon for the mounted directories:
It is currently not possible to run texd in container mode, while texd itself is running containerized:
This will start the texd container just fine, but fails to execute any jobs, because the job directory (
/texd
) only exists within the texd container and texd tries to mount it in a new container.When started with a
bind
orvolume
mount:executing jobs still fails, because texd basically tries to run the following command:
Docker commands however are run on the Docker host, and the name of the job directory is
$(pwd)/jobs/job-1234
, not/texd/job-1234
.I believe, a simple rewrite mechanism for the job directory when starting job containers should suffice. Detecting whether texd runs Docker-in-Docker is a bit harder, but still doable. Given the container ID (found in
/proc/1/cpuset
), we can simply ask the docker daemon for the mounted directories:and perform a simple match of the
--job-directory
CLI argument againstMounts[i].Destination
.