bmuschko/gradle-docker-plugin

DockerCreateContainer.start() doesn't create build/.docker dir

FyiurAmron opened this issue · 2 comments

Expected Behavior

Running DockerCreateContainer-based task via start() should work with no exception.

Current Behavior

Running DockerCreateContainer-based task via start() first doesn't create the build/.docker directory and then silently fails to create respective PROJECTNAME_createMySql-containerId.txt, which causes it to terminate with

java.nio.file.NoSuchFileException: PROJECTPATH\build\.docker\PROJECTNAME_createMySql-containerId.txt

if the build\.docker dir is not already present. The docker container itself is created successfully.

If the directory is created manually or exists, everything works OK.

Context

Running a custom task that uses dockerCreateContainerTask.start() to create the docker container itself.

Workarounds

Adding e.g. mkdir(layout.buildDirectory.dir(".docker")) before calling start().

Steps to Reproduce (for bugs)

  1. run DockerCreateContainer-based task via start()
  2. see how it fails when build/.docker doesn't exist.

Your Environment

tested on Gradle 8.1.1 & 8.3 and Temurin 17.0.8
tested on plugin ver 9.3.1 & 9.3.3

Calling the method annotated with @TaskAction directly from code is not best practice and should be avoided completely. Let me know if the issue still arises when executing the action by other means (e.g. dependsOn or by implicit task dependency declaration).

Closing this issue. I assume that this issue only occurred because you invoked the task action directly.