Docker cannot open Dockerfile in dynamic workspace

Hello,
I’m experimenting dynamic workspace feature, but Docker build fails to open Dockerfile raising

ERROR: unable to prepare context: path ".\\Dockerfile" not found

I also tried to use absolute path for Dockerfile with the same result.

Using Docker on a standard workspace works fine.

I’m on Windows 11 and Docker Desktop 4.34.2

Thank you very much,
Giovanni

I guess this file path for the Docker file doesn’t exist on disk. Why are trying to use a dynamic workspace in this scenario? Is this an automation machine?

Hi Carlos,

Dockerfile file exists on the disk (we can read it using type Dockerfile).

The procedure works fine using the same project on a non dynamic workspace.

I’m just trying to experiment dynamic workspace feature on my dev machine.

Could you share with us the error you get if using absolute paths? (you have already indicated that they fail, but it would be nice to see what Docker spits out).

Could you also try launching Docker with a file that does not exit to see the error message? (please do not do this test in the dynamic workspace, but in any other directory).

We are running a test and I’m not able to find any file when using this command. I’m not a Docker expert, but could you try using the following parameters?

docker build -t docker-tag . -f .\dockerfile.txt
ERROR: failed to solve: failed to read dockerfile: open dockerfile.txt: no such file or directory

Using a simple Dockerfile

FROM alpine
CMD ["echo", "Hello, World!"]

standard workspace on the left, dynamic one on the right

It seems it’s not possible to specify complete filepath for Dockerfile even if it is possible to specify the path only as follows:

Are you getting any specific errors?

We have been debugging this error in detail. The Docker error is referencing a “\Device.…” path.
This is the path in the NT tree PlasticFS is using:
eg:
\Device\Volume{41d6fc22-8224-11ef-937b-147dda9d4d35}\

The problem is Docker does not support junctions pointing to NT paths. This only affects the PlasticFS workspace mount point where that type of junction is used.

WORKAROUND: Use a letter as a mount point for the PlasticFS workspace (eg:Z:). Please let us know if it helps.

The only errors it raises is:
ERROR: failed to solve: failed to read dockerfile: open Dockerfile: no such file or directory

Sorry, I don’t understand. My workspace doesn’t contain any junction.

Moreover, I don’t knoww to mount with a letter my dyn workpsace

Thank you
Giovanni

It does because if you create a dynamic workspace, it creates a junction pointing to an NT path. This only affects the PlasticFS workspace mount point where that junction type is used. Docker doesn’t support junctions pointing to NT paths.

You can use the following command:
cm wk mk <wk_name> Z: --dynamic --tree=br:/main@<repo>

Let me expand on this. Drives can be “mounted” into the directory tree as a junction on Windows.
For instance, you can mount your “D: drive” using a directory, like “C:\Users<User>\MyDrive”. This is achieved by using a specific type of junction.

PlasticFS drives are no different, so whenever you specify the workspace directory on creation, that directory will be created as a junction whenever the workspace is mounted (and removed, whenever you unmount it or stop PlasticFS). This is not done by PlasticFS directly, so we have no real control over it.
This junction redirects to the real location of the PlasticFS drive, but it seems that Docker does not properly support this specific kind of junction.
Hence, using a drive letter directly should avoid this specific issue altogether, and we can check if something else prevents it from reading the dockerfile.

I tried to use a folder junction to check Docker behaviour in this case, and it seems to work fine

Anyway, the workaround you suggested seems to work.

Thank you very much.
Giovanni